pub fn encode_projected_to_slice<'out, 'value, T: Serialize>(
output: &'out mut [u8],
encoding: Encoding,
limits: Limits,
prepare: impl FnOnce(&WriteContext<'_>) -> Result<Projected<'value, T>, Error>,
) -> Result<&'out [u8], Error>Expand description
Prepare envelopes and encode the DTO once into caller-owned output.
The destination is already allocated. Envelope preparation and DTO serialization share one resource meter. Only the successful returned prefix contains a complete encoding.
§Errors
Returns a preparation, serialization or allowance error. A short
destination returns Limit(Output). A failed operation may modify the
caller’s output and scratch.