Function alkahest::serialize_or_size
source · pub fn serialize_or_size<F, T>(
value: T,
output: &mut [u8]
) -> Result<(usize, usize), BufferSizeRequired>where
F: Formula + ?Sized,
T: Serialize<F>,
Expand description
Serialize value into bytes slice. Returns the number of bytes written.
If the buffer is too small, returns error that contains the exact number of bytes required.
Use serialize
if this information is not needed.
Errors
Returns BufferSizeRequired
error if the buffer is too small.
Error contains the exact number of bytes required.