pub struct ObjectRefBuilder<'a>(/* private fields */);Expand description
Builder for encoding an object.
Implementations§
Source§impl<'a> ObjectRefBuilder<'a>
impl<'a> ObjectRefBuilder<'a>
Sourcepub fn try_new(
bytes: &'a mut Vec<u8>,
element_count: u16,
key_sorted: bool,
) -> Result<Self, BuildError>
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.
Sourcepub fn finish(self) -> Result<&'a Yason, BuildError>
pub fn finish(self) -> Result<&'a Yason, BuildError>
Finishes building the object.
Source§impl ObjectRefBuilder<'_>
impl ObjectRefBuilder<'_>
Sourcepub fn push_object<Key: AsRef<str>>(
&mut self,
key: Key,
element_count: u16,
key_sorted: bool,
) -> Result<ObjectRefBuilder<'_>, BuildError>
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.
Sourcepub fn push_array<Key: AsRef<str>>(
&mut self,
key: Key,
element_count: u16,
) -> Result<ArrayRefBuilder<'_>, BuildError>
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.
Sourcepub fn push_string<Key: AsRef<str>, Val: AsRef<str>>(
&mut self,
key: Key,
value: Val,
) -> Result<&mut Self, BuildError>
pub fn push_string<Key: AsRef<str>, Val: AsRef<str>>( &mut self, key: Key, value: Val, ) -> Result<&mut Self, BuildError>
Pushes a string value.
Sourcepub fn push_number<Key: AsRef<str>, Num: AsRef<Number>>(
&mut self,
key: Key,
value: Num,
) -> Result<&mut Self, BuildError>
pub fn push_number<Key: AsRef<str>, Num: AsRef<Number>>( &mut self, key: Key, value: Num, ) -> Result<&mut Self, BuildError>
Pushes a number 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> 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