Skip to main content

encode_into

Function encode_into 

Source
pub fn encode_into<'out, T: Serialize + ?Sized>(
    value: &T,
    encoding: Encoding,
    limits: Limits,
    output: &'out mut Vec<u8>,
) -> Result<&'out [u8], Error>
Expand description

Encode into reusable storage, returning only the completed prefix.

Prior contents are cleared, including on error; capacity retention on failure is not promised. Keep retained retry bytes elsewhere. Preflight completes before codec output reservation. Custom serializers must be deterministic; writes remain bounded by preflight length even if a second pass grows.

ยงErrors

Returns Limit for exhausted allowances, Allocation for failed output reservation, otherwise Malformed for serialization failure.