Function zvariant::to_writer_for_signature

source ·
pub unsafe fn to_writer_for_signature<'s, W, S, T>(
    writer: &mut W,
    ctxt: Context,
    signature: S,
    value: &T
) -> Result<Written>
where W: Write + Seek, S: TryInto<Signature<'s>>, S::Error: Into<Error>, T: ?Sized + Serialize,
Expand description

Serialize T that has the given signature, to the given writer.

Use this function instead of to_writer if the value being serialized does not implement DynamicType.


On Unix systems, the returned Written instance can contain file descriptors and therefore the caller is responsible for not dropping the returned Written instance before the writer. Otherwise, the file descriptors in the Written instance will be closed while serialized data will still refer to them. Hence why this function is marked unsafe.

On non-Unix systems, the returned Written instance will not contain any file descriptors and hence is safe to drop.