[−][src]Struct cbor_data::DictBuilder
Builder for an dict value.
Calling the finish() method will return either the fully constructed
CBOR value (if this was the top-level dict) or the builder of the array or dict into
which this dict was placed.
If you want to recursively create a CBOR structure without statically known recursion limit
then you’ll want to take a look at the WriteToDict::write_dict_rec()
method (the compiler would otherwise kindly inform you of a type expansion hitting the recursion
limit while instantiating your recursive function).
Implementations
impl<'a, T: 'static> DictBuilder<'a, T>[src]
pub fn finish(self) -> T[src]
Finish building this dict and return to the outer context. In case of a
top-level dict this returns the complete Cbor value.
pub fn write_array(self, key: &str, tag: Option<u64>) -> ArrayBuilder<'a, Self>[src]
Write a nested array that is then filled by the returned builder.
You can resume building this outer dict by using the finish()
method.
pub fn write_dict(self, key: &str, tag: Option<u64>) -> DictBuilder<'a, Self>[src]
Write a nested dict that is then filled by the returned builder.
You can resume building this outer dict by using the finish()
method.
Trait Implementations
impl<'a, T: 'static> WriteToDict for DictBuilder<'a, T>[src]
pub fn write_pos(&mut self, key: &str, value: u64, tag: Option<u64>)[src]
pub fn write_neg(&mut self, key: &str, value: u64, tag: Option<u64>)[src]
pub fn write_bytes(&mut self, key: &str, value: &[u8], tag: Option<u64>)[src]
pub fn write_str(&mut self, key: &str, value: &str, tag: Option<u64>)[src]
pub fn write_bool(&mut self, key: &str, value: bool, tag: Option<u64>)[src]
pub fn write_null(&mut self, key: &str, tag: Option<u64>)[src]
pub fn write_undefined(&mut self, key: &str, tag: Option<u64>)[src]
pub fn write_lit(&mut self, key: &str, value: Literal, tag: Option<u64>)[src]
pub fn write_array_rec(
&mut self,
key: &str,
tag: Option<u64>,
f: &mut dyn FnMut(&mut dyn WriteToArray)
)[src]
&mut self,
key: &str,
tag: Option<u64>,
f: &mut dyn FnMut(&mut dyn WriteToArray)
)
pub fn write_dict_rec(
&mut self,
key: &str,
tag: Option<u64>,
f: &mut dyn FnMut(&mut dyn WriteToDict)
)[src]
&mut self,
key: &str,
tag: Option<u64>,
f: &mut dyn FnMut(&mut dyn WriteToDict)
)
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for DictBuilder<'a, T>[src]
impl<'a, T> !Send for DictBuilder<'a, T>[src]
impl<'a, T> !Sync for DictBuilder<'a, T>[src]
impl<'a, T> Unpin for DictBuilder<'a, T>[src]
impl<'a, T> !UnwindSafe for DictBuilder<'a, T>[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,