cborrs::cbordet

Function cbor_det_size

Source
pub fn cbor_det_size<'a>(x: CborDet<'a>, bound: usize) -> Option<usize>
Expand description

Computes the byte size of the binary representation of the Deterministic CBOR object x following RFC 8949 Section 4.2.1, but without serializing x. Returns None if that size is strictly larger than bound; Some(size) otherwise. This function uses stack space in the order of the level of nesting of the use of “constructor” functions used to build x; the computation of the sizes 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 computation does not recursively nest into such subobjects.)