pub trait SerialCtx {
// Required method
fn serial_ctx<W: Write>(
&self,
size_length: SizeLength,
out: &mut W
) -> Result<(), W::Err>;
}
Expand description
The SerialCtx
trait provides a means of writing structures into byte-sinks
(Write
) using contextual information.
The contextual information is:
size_length
: The number of bytes used to record the length of the data.
Required Methods§
sourcefn serial_ctx<W: Write>(
&self,
size_length: SizeLength,
out: &mut W
) -> Result<(), W::Err>
fn serial_ctx<W: Write>( &self, size_length: SizeLength, out: &mut W ) -> Result<(), W::Err>
Attempt to write the structure into the provided writer, failing if
if the length cannot be represented in the provided size_length
or
only part of the structure could be written.
NB: We use Result instead of Option for better composability with other constructs.
Object Safety§
This trait is not object safe.