Function cbor_event::se::serialize_cbor_in_cbor
source · pub fn serialize_cbor_in_cbor<T, W>(
data: T,
serializer: &mut Serializer<W>
) -> Result<&mut Serializer<W>>where
T: Serialize,
W: Write + Sized,
Expand description
helper function to serialise cbor in cbor
The existence of this function is questionable as it does not make sense, from the CBOR protocol point of view, to encode cbor inside cbor. However it is the way the haskell base code is serialising some objects so we need to comply here too
This function is a more efficient version of:
let mut serializer = Serializer::new_vec();
let mut se = Serializer::new_vec();
0u32.serialize(&mut se).unwrap();
serializer.write_bytes(&se.finalize()).unwrap();