pub struct MapBuilder { /* private fields */ }Expand description
Builder for a canonical CBOR map.
Keys can be any Value. Each key is encoded once at insert time so
the underlying BTreeMap automatically yields entries in canonical
(encoded-byte-lexicographic) order.
Implementations§
Source§impl MapBuilder
impl MapBuilder
Sourcepub fn entry(self, key: Value, value: Value) -> Self
pub fn entry(self, key: Value, value: Value) -> Self
Insert a (key, value) pair. Subsequent calls with the same encoded
key replace the previous entry (canonical CBOR forbids duplicate
keys, so this is the right behavior in practice).
Sourcepub fn text_entry(self, key: &str, value: Value) -> Self
pub fn text_entry(self, key: &str, value: Value) -> Self
Convenience for text keys.
Trait Implementations§
Source§impl Debug for MapBuilder
impl Debug for MapBuilder
Source§impl Default for MapBuilder
impl Default for MapBuilder
Source§fn default() -> MapBuilder
fn default() -> MapBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MapBuilder
impl RefUnwindSafe for MapBuilder
impl Send for MapBuilder
impl Sync for MapBuilder
impl Unpin for MapBuilder
impl UnsafeUnpin for MapBuilder
impl UnwindSafe for MapBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more