cborrs::cbordet

Function cbor_det_serialize

Source
pub fn cbor_det_serialize<'a>(
    x: CborDet<'a>,
    output: &'a mut [u8],
) -> Option<usize>
Expand description

Writes the binary representation of the Deterministic CBOR object x into the first bytes of the output byte slice, following RFC 8949 Section 4.2.1. This function first checks the size of x and returns None if it is larger than the size of output; otherwise it returns Some(size), where size is the byte size of x, the number of bytes written to output. This function uses stack space in the order of the level of nesting of the use of “constructor” functions used to build x; the serialization of those “subobjects” of x obtained from cbor_det_parse uses only constant extra stack space for each such subobject (in the sense that the serialization does not recursively nest into such subobjects.)