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: Serialize + ?Sized,
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.

§Safety

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.