Skip to main content

encode_projected_into

Function encode_projected_into 

Source
pub fn encode_projected_into<'out, 'value, T: Serialize>(
    output: &'out mut Vec<u8>,
    encoding: Encoding,
    limits: Limits,
    prepare: impl FnOnce(&WriteContext<'_>) -> Result<Projected<'value, T>, Error>,
) -> Result<&'out [u8], Error>
Expand description

Prepare envelopes in caller-owned scratch space and encode the resulting DTO.

Envelope preparation, DTO sizing and DTO writing each debit the same meter. Returns the final slice in reusable output storage.

ยงErrors

Clears the output on any failure. A failed preparation may modify its own scratch storage. Custom serializers must agree on their size across passes.