pub struct Object<S> { /* private fields */ }
Expand description
A Object value
Implementations
sourceimpl<S> Object<S>
impl<S> Object<S>
sourcepub fn with_capacity(size: usize) -> Self
pub fn with_capacity(size: usize) -> Self
Create a new Object value with a fixed number of preallocated slots for field-value pairs
sourcepub fn add_field<K>(&mut self, k: K, value: Value<S>) -> Option<Value<S>>where
K: Into<String>,
for<'a> &'a str: PartialEq<K>,
pub fn add_field<K>(&mut self, k: K, value: Value<S>) -> Option<Value<S>>where
K: Into<String>,
for<'a> &'a str: PartialEq<K>,
Add a new field with a value
If there is already a field with the same name the old value is returned
sourcepub fn contains_field<K>(&self, f: K) -> boolwhere
for<'a> &'a str: PartialEq<K>,
pub fn contains_field<K>(&self, f: K) -> boolwhere
for<'a> &'a str: PartialEq<K>,
Check if the object already contains a field with the given name
sourcepub fn iter(&self) -> FieldIter<'_, S>
pub fn iter(&self) -> FieldIter<'_, S>
Get a iterator over all field value pairs
This method returns a iterator over &'a (String, Value)
sourcepub fn iter_mut(&mut self) -> FieldIterMut<'_, S>
pub fn iter_mut(&mut self) -> FieldIterMut<'_, S>
Get a iterator over all mutable field value pairs
This method returns a iterator over &mut 'a (String, Value)
sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
Get the current number of fields
Trait Implementations
sourceimpl<K, S> FromIterator<(K, Value<S>)> for Object<S>where
K: Into<String>,
for<'a> &'a str: PartialEq<K>,
impl<K, S> FromIterator<(K, Value<S>)> for Object<S>where
K: Into<String>,
for<'a> &'a str: PartialEq<K>,
sourcefn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = (K, Value<S>)>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = (K, Value<S>)>,
Creates a value from an iterator. Read more
sourceimpl<S> IntoIterator for Object<S>
impl<S> IntoIterator for Object<S>
sourceimpl<S: PartialEq> PartialEq<Object<S>> for Object<S>
impl<S: PartialEq> PartialEq<Object<S>> for Object<S>
impl<S> StructuralPartialEq for Object<S>
Auto Trait Implementations
impl<S> RefUnwindSafe for Object<S>where
S: RefUnwindSafe,
impl<S> Send for Object<S>where
S: Send,
impl<S> Sync for Object<S>where
S: Sync,
impl<S> Unpin for Object<S>where
S: Unpin,
impl<S> UnwindSafe for Object<S>where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more