Struct cbor_data::DictWriter[][src]

pub struct DictWriter<'a>(_);

Builder for a dict value, used by write_dict_rec().

see trait Encoder for usage examples

Implementations

impl<'a> DictWriter<'a>[src]

pub fn set_max_definite_size(&mut self, size: Option<u64>)[src]

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
[src]

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));
});

pub fn with_cbor_key(
    &mut self,
    k: impl FnOnce(SingleBuilder<'_, '_>) -> SingleResult,
    v: impl FnOnce(SingleBuilder<'_, '_>) -> SingleResult
) -> &mut Self
[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for DictWriter<'a>

impl<'a> Send for DictWriter<'a>

impl<'a> Sync for DictWriter<'a>

impl<'a> Unpin for DictWriter<'a>

impl<'a> !UnwindSafe for DictWriter<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.