zvariant

Function to_bytes_for_signature

source
pub fn to_bytes_for_signature<B, T>(
    ctxt: EncodingContext<B>,
    signature: &Signature<'_>,
    value: &T,
) -> Result<Vec<u8>>
where B: ByteOrder, T: Serialize + ?Sized,
Expand description

Serialize T that has the given signature, to a new byte vector.

Use this function instead of to_bytes if the value being serialized does not implement Type. See from_slice_for_signature documentation for an example of how to use this function.

§Panics

This function will panic if the value to serialize contains file descriptors. Use to_bytes_fds_for_signature if you’d want to potentially pass FDs.