Struct cbor_data::CborBuilder[][src]

pub struct CborBuilder<'a, O: CborOutput> { /* fields omitted */ }

Builder for a single CBOR value.

Implementations

impl<'a> CborBuilder<'a, WithOutput>[src]

pub fn new() -> Self[src]

Create a builder that writes into its own fresh vector.

pub fn with_scratch_space(v: &'a mut Vec<u8>) -> Self[src]

Create a builder that clears the given vector and writes into it.

You can use this to reuse a scratch space across multiple values being built, e.g. by keeping the same vector in a thread-local variable.

impl<'a> CborBuilder<'a, NoOutput>[src]

pub fn append_to(v: &'a mut Vec<u8>) -> Self[src]

Append the CBOR bytes to the given vector and do not return a separate output value.

let mut v = Vec::new();
let result: () = CborBuilder::append_to(&mut v).write_pos(12, None);

assert_eq!(v, vec![12u8])

impl<'a, O: CborOutput> CborBuilder<'a, O>[src]

pub fn with_max_definite_size(self, max_definite: Option<u64>) -> Self[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.

Trait Implementations

impl Default for CborBuilder<'static, WithOutput>[src]

impl<'a, O: CborOutput> Writer for CborBuilder<'a, O>[src]

type Output = O::Output

Auto Trait Implementations

impl<'a, O> RefUnwindSafe for CborBuilder<'a, O> where
    O: RefUnwindSafe

impl<'a, O> Send for CborBuilder<'a, O> where
    O: Send

impl<'a, O> Sync for CborBuilder<'a, O> where
    O: Sync

impl<'a, O> Unpin for CborBuilder<'a, O> where
    O: Unpin

impl<'a, O> !UnwindSafe for CborBuilder<'a, O>

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.