Skip to main content

encode_to_vec

Function encode_to_vec 

Source
pub fn encode_to_vec<T: Serialize>(value: &T) -> Result<Vec<u8>, CodecError>
Expand description

Serializes value into a freshly allocated, framed codec buffer.

The output is MAGIC ++ VERSION ++ body. Deterministic: equal values produce byte-identical output.

§Errors

Returns CodecError if value’s Serialize impl drives the format outside the supported positional model, such as an unbounded sequence whose length is not known up front.