pub struct Object { /* private fields */ }Expand description
A JS object’s own properties, in JS’s order: keys that are array indices first, in ascending order, then the other keys in the order they were added. Setting a key that exists keeps its position.
Implementations§
Source§impl Object
impl Object
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get(&self, key: &str) -> Option<&Value>
pub fn get(&self, key: &str) -> Option<&Value>
The property key, None when it is absent. A property set to
Value::Undefined is present.
pub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
pub fn contains_key(&self, key: &str) -> bool
Sourcepub fn remove(&mut self, key: &str) -> Option<Value>
pub fn remove(&mut self, key: &str) -> Option<Value>
delete object[key], returning the value it held.
pub fn iter(&self) -> impl Iterator<Item = (&str, &Value)>
pub fn keys(&self) -> impl Iterator<Item = &str>
Trait Implementations§
Source§impl ExtensionConfigBase for Object
impl ExtensionConfigBase for Object
Source§fn shallow_merge(&self, overrides: &Object) -> Self
fn shallow_merge(&self, overrides: &Object) -> Self
shallowMergeConfig’s body: the config when every key of the
overrides holds what the config holds (an absent key holds
undefined), otherwise {...config, ...overrides}. Values compare
by == where JS’s !== compares objects by identity, which only
decides whether the result is a copy.
impl StructuralPartialEq for Object
Auto Trait Implementations§
impl Forget for Object
impl Freeze for Object
impl Move for Object
impl RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl UnsafeUnpin for Object
impl UnwindSafe for Object
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