Struct cbor_data::DictWriter [−][src]
pub struct DictWriter<'a>(_);Expand description
Builder for a dict value, used by write_dict_rec().
see trait Encoder for usage examples
Implementations
Configure the limit above which indefinite size encoding will be used.
The default is 255, which is the largest size up to which definite size is at least as
compact as indefinite size. Set to 23 to avoid moving bytes around when finishing the array.
Set to None to always use indefinite size encoding.
pub fn with_key(
&mut self,
key: &str,
f: impl FnOnce(SingleBuilder<'_, '_>) -> SingleResult
) -> &mut Self
pub fn with_key(
&mut self,
key: &str,
f: impl FnOnce(SingleBuilder<'_, '_>) -> SingleResult
) -> &mut Self
Add one key–value pair to the dict.
let cbor = CborBuilder::new().encode_dict(|builder| {
builder.with_key("the answer", |b| b.encode_u64(42));
});