ObjectRefBuilder

Struct ObjectRefBuilder 

Source
pub struct ObjectRefBuilder<'a>(/* private fields */);
Expand description

Builder for encoding an object.

Implementations§

Source§

impl<'a> ObjectRefBuilder<'a>

Source

pub fn try_new( bytes: &'a mut Vec<u8>, element_count: u16, key_sorted: bool, ) -> Result<Self, BuildError>

Creates ObjectRefBuilder with specified element count. key_sorted indicates whether the object is sorted by key.

Source

pub fn finish(self) -> Result<&'a Yason, BuildError>

Finishes building the object.

Source§

impl ObjectRefBuilder<'_>

Source

pub fn push_object<Key: AsRef<str>>( &mut self, key: Key, element_count: u16, key_sorted: bool, ) -> Result<ObjectRefBuilder<'_>, BuildError>

Pushes an embedded object with specified element count and a flag which indicates whether the embedded object is sorted by key.

Source

pub fn push_array<Key: AsRef<str>>( &mut self, key: Key, element_count: u16, ) -> Result<ArrayRefBuilder<'_>, BuildError>

Pushes an embedded array with specified element count.

Source

pub fn push_string<Key: AsRef<str>, Val: AsRef<str>>( &mut self, key: Key, value: Val, ) -> Result<&mut Self, BuildError>

Pushes a string value.

Source

pub fn push_number<Key: AsRef<str>, Num: AsRef<Number>>( &mut self, key: Key, value: Num, ) -> Result<&mut Self, BuildError>

Pushes a number value.

Source

pub fn push_bool<Key: AsRef<str>>( &mut self, key: Key, value: bool, ) -> Result<&mut Self, BuildError>

Pushes a bool value.

Source

pub fn push_null<Key: AsRef<str>>( &mut self, key: Key, ) -> Result<&mut Self, BuildError>

Pushes a null value.

Auto Trait Implementations§

§

impl<'a> Freeze for ObjectRefBuilder<'a>

§

impl<'a> RefUnwindSafe for ObjectRefBuilder<'a>

§

impl<'a> Send for ObjectRefBuilder<'a>

§

impl<'a> Sync for ObjectRefBuilder<'a>

§

impl<'a> Unpin for ObjectRefBuilder<'a>

§

impl<'a> !UnwindSafe for ObjectRefBuilder<'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.