pub struct Object { /* private fields */ }Expand description
A JSON object: string keys to Values, with keys kept the way a JS
object keeps its properties.
Keys are in JS property order: integer-like keys (array indices, such as
"0" and "10", but not "01") first in ascending numeric order, then
the others in the order they were first set. This is the order
Object.keys and JSON.stringify use.
Setting a key that is already there replaces its value and keeps its place, as assigning to an existing property does in JS. Two objects are equal when they have the same keys with equal values, in any order.
Cloning an object is cheap: copies share their entries until one of them is changed, so a row read from the replica, its diff, and the IVM sources is one set of entries.
Implementations§
Source§impl Object
impl Object
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, key: &str) -> Option<&Value>
pub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
pub fn contains_key(&self, key: &str) -> bool
Sourcepub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
pub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
Sets key to value, returning the value it replaced. A new key goes
after the others, or among the integer-like keys in numeric order.
Sourcepub fn remove(&mut self, key: &str) -> Option<Value>
pub fn remove(&mut self, key: &str) -> Option<Value>
Removes key, returning its value. The other keys keep their order.
pub fn keys( &self, ) -> impl DoubleEndedIterator<Item = &String> + ExactSizeIterator + Clone
pub fn values( &self, ) -> impl DoubleEndedIterator<Item = &Value> + ExactSizeIterator + Clone
Trait Implementations§
Source§impl<K: Into<String>> FromIterator<(K, Value)> for Object
impl<K: Into<String>> FromIterator<(K, Value)> for Object
Source§fn from_iter<I: IntoIterator<Item = (K, Value)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (K, Value)>>(iter: I) -> Self
A key that repeats keeps its first place and its last value, as in a JS object literal.