Struct ijson::object::IObject [−][src]
#[repr(transparent)]pub struct IObject(_);
The IObject
type is similar to a HashMap<IString, IValue>
. As with the
IArray
, the length and capacity are stored inside the heap allocation.
In addition, IObject
s preserve the insertion order of their elements, in
case that is important in the original JSON.
Removing from an IObject
will disrupt the insertion order.
Implementations
impl IObject
[src]
pub fn new() -> Self
[src]
Constructs a new empty IObject
. Does not allocate.
pub fn with_capacity(cap: usize) -> Self
[src]
Constructs a new IObject
with the specified capacity. At least that many entries
can be added to the object without reallocating.
pub fn capacity(&self) -> usize
[src]
Returns the capacity of the object. This is the maximum number of entries the object can hold without reallocating.
pub fn len(&self) -> usize
[src]
Returns the number of entries currently stored in the object.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the object is empty.
pub fn reserve(&mut self, additional: usize)
[src]
Reserves space for at least this many additional entries.
pub fn entry(&mut self, key: impl Into<IString>) -> Entry<'_>
[src]
Returns a view of an entry within this object.
pub fn entry_or_clone(&mut self, key: &IString) -> Entry<'_>
[src]
Returns a view of an entry within this object, whilst avoiding cloning the key if the entry is already occupied.
pub fn keys(&self) -> impl Iterator<Item = &IString>
[src]
Returns an iterator over references to the keys in this object.
pub fn values(&self) -> impl Iterator<Item = &IValue>
[src]
Returns an iterator over references to the values in this object.
pub fn iter(&self) -> Iter<'_>ⓘ
[src]
Returns an iterator over (&key, &value) pairs in this object.
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut IValue>
[src]
Returns an iterator over mutable references to the values in this object.
pub fn iter_mut(&mut self) -> IterMut<'_>ⓘ
[src]
Returns an iterator over (&key, &mut value) pairs in this object.
pub fn clear(&mut self)
[src]
Removes all entries from the object. The capacity is unchanged.
pub fn get_key_value(&self, k: impl ObjectIndex) -> Option<(&IString, &IValue)>
[src]
Looks up the specified key in this object and returns a (&key, &value) pair if found.
pub fn get_key_value_mut(
&mut self,
k: impl ObjectIndex
) -> Option<(&IString, &mut IValue)>
[src]
&mut self,
k: impl ObjectIndex
) -> Option<(&IString, &mut IValue)>
Looks up the specified key in this object and returns a (&key, &mut value) pair if found.
pub fn get(&self, k: impl ObjectIndex) -> Option<&IValue>
[src]
Looks up the specified key in this object and returns a reference to the corresponding value if found.
pub fn get_mut(&mut self, k: impl ObjectIndex) -> Option<&mut IValue>
[src]
Looks up the specified key in this object and returns a mutable reference to the corresponding value if found.
pub fn contains_key(&self, k: impl ObjectIndex) -> bool
[src]
Returns true
if the specified key exists in the object.
pub fn insert(
&mut self,
k: impl Into<IString>,
v: impl Into<IValue>
) -> Option<IValue>
[src]
&mut self,
k: impl Into<IString>,
v: impl Into<IValue>
) -> Option<IValue>
Inserts a new value into this object with the specified key. If a value already existed at this key, that value is replaced and returend.
pub fn remove_entry(&mut self, k: impl ObjectIndex) -> Option<(IString, IValue)>
[src]
Removes the entry at the specified key, returning both the key and value if found.
pub fn remove(&mut self, k: impl ObjectIndex) -> Option<IValue>
[src]
Removes the entry at the specified key, returning the value if found.
pub fn shrink_to_fit(&mut self)
[src]
Shrinks the memory allocation used by the object such that its capacity becomes equal to its length.
pub fn retain(&mut self, f: impl FnMut(&IString, &mut IValue) -> bool)
[src]
Calls the specified function for each entry in the object. Each entry
where the function returns false
is removed from the object.
The function also has the ability to modify the values in-place.
Trait Implementations
impl AsMut<IValue> for IObject
[src]
impl AsRef<IValue> for IObject
[src]
impl Borrow<IValue> for IObject
[src]
impl BorrowMut<IValue> for IObject
[src]
fn borrow_mut(&mut self) -> &mut IValue
[src]
impl Clone for IObject
[src]
impl Debug for IObject
[src]
impl Default for IObject
[src]
impl<'de> Deserialize<'de> for IObject
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl<'de> Deserializer<'de> for &'de IObject
[src]
type Error = Error
The error type that can be returned if some error occurs during deserialization. Read more
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_enum<V>(
self,
_name: &'static str,
_variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
[src]
self,
_name: &'static str,
_variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
[src]
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn is_human_readable(&self) -> bool
[src]
impl Eq for IObject
[src]
impl<K: Into<IString>, V: Into<IValue>> Extend<(K, V)> for IObject
[src]
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<K: Into<IString>, V: Into<IValue>> From<BTreeMap<K, V>> for IObject
[src]
impl<K: Into<IString>, V: Into<IValue>> From<HashMap<K, V, RandomState>> for IObject
[src]
impl From<IObject> for IValue
[src]
impl<K: Into<IString>, V: Into<IValue>> FromIterator<(K, V)> for IObject
[src]
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self
[src]
impl Hash for IObject
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<I: ObjectIndex> Index<I> for IObject
[src]
impl<I: ObjectIndex> IndexMut<I> for IObject
[src]
impl IntoIterator for IObject
[src]
type Item = (IString, IValue)
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> IntoIterator for &'a IObject
[src]
type Item = (&'a IString, &'a IValue)
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> IntoIterator for &'a mut IObject
[src]
type Item = (&'a IString, &'a mut IValue)
The type of the elements being iterated over.
type IntoIter = IterMut<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl PartialEq<IObject> for IObject
[src]
impl PartialOrd<IObject> for IObject
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for IObject
[src]
impl<'a> TryFrom<&'a IValue> for &'a IObject
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(other: &'a IValue) -> Result<Self, ()>
[src]
impl<'a> TryFrom<&'a mut IValue> for &'a mut IObject
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(other: &'a mut IValue) -> Result<Self, ()>
[src]
impl TryFrom<IValue> for IObject
[src]
Auto Trait Implementations
impl RefUnwindSafe for IObject
impl Send for IObject
impl Sync for IObject
impl Unpin for IObject
impl UnwindSafe for IObject
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,