flexbuffers

Struct MapBuilder

Source
pub struct MapBuilder<'a> { /* private fields */ }
Expand description

Builds a Flexbuffer map, returned by a Builder.

§Side effect when dropped:

When this is dropped, or end_map is called, the map is commited to the buffer. If this map is the root of the flexbuffer, then the root is written and the flexbuffer is complete.

§Panics:

  • Duplicate keys will result in a panic in both debug and release mode.
  • Keys with internal nulls results in a panic in debug mode and result in silent truncaction in release mode.

Implementations§

Source§

impl<'a> MapBuilder<'a>

Source

pub fn push<P: Pushable>(&mut self, key: &str, p: P)

Push p onto this map with key key. This will panic (in debug mode) if key contains internal nulls.

Source

pub fn start_vector(&mut self, key: &str) -> VectorBuilder<'_>

Starts a nested vector that will be pushed onto this map with key key when it is dropped.

This will panic (in debug mode) if key contains internal nulls.

Source

pub fn start_map(&mut self, key: &str) -> MapBuilder<'_>

Starts a nested map which that will be pushed onto this map with key key when it is dropped.

This will panic (in debug mode) if key contains internal nulls.

Source

pub fn end_map(self)

end_map sorts the map by key and writes it to the buffer. This happens anyway when the map builder is dropped.

Trait Implementations§

Source§

impl<'a> Drop for MapBuilder<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MapBuilder<'a>

§

impl<'a> RefUnwindSafe for MapBuilder<'a>

§

impl<'a> Send for MapBuilder<'a>

§

impl<'a> Sync for MapBuilder<'a>

§

impl<'a> Unpin for MapBuilder<'a>

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.