pub struct Object<'a> { /* private fields */ }
Expand description
Container that stores its elements with numeric keys and provides
get by key access. Keys are of &str
type
Implementations§
Source§impl<'a> Object<'a>
impl<'a> Object<'a>
Sourcepub fn add_value<'c, 'p: 'c, 'd>(
&'p mut self,
key: &str,
value: impl AsValue<'d>,
) -> Result<Value<'c>, Error>
pub fn add_value<'c, 'p: 'c, 'd>( &'p mut self, key: &str, value: impl AsValue<'d>, ) -> Result<Value<'c>, Error>
Adds new field with given name and value to this object
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns slice of bytes representing current document.
It’s guaranteed to be subslice of initial buffer and for root document it will starting at 0.
So by taking it’s len you can get how many bytes in buffer are used
Sourcepub fn empty() -> Object<'static>
pub fn empty() -> Object<'static>
Returns new empty object
Object is read only so no new elements can be added to it
Trait Implementations§
impl<'a> Eq for Object<'a>
impl<'a> StructuralPartialEq for Object<'a>
Auto Trait Implementations§
impl<'a> Freeze for Object<'a>
impl<'a> RefUnwindSafe for Object<'a>
impl<'a> !Send for Object<'a>
impl<'a> !Sync for Object<'a>
impl<'a> Unpin for Object<'a>
impl<'a> UnwindSafe for Object<'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