Trait simd_json::value::Mutable [−][src]
pub trait Mutable: IndexMut<usize> + Value { fn as_array_mut(&mut self) -> Option<&mut Self::Array>; fn as_object_mut(&mut self) -> Option<&mut Self::Object>; fn insert<K, V>(
&mut self,
k: K,
v: V
) -> Result<Option<Self::Target>, AccessError>
where
V: Into<Self::Target>,
K: Into<Self::Key>,
Self::Key: Hash,
Self::Key: Eq, { ... } fn try_insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Target>
where
V: Into<Self::Target>,
K: Into<Self::Key>,
Self::Key: Hash,
Self::Key: Eq, { ... } fn remove<Q>(&mut self, k: &Q) -> Result<Option<Self::Target>, AccessError>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, { ... } fn try_remove<Q>(&mut self, k: &Q) -> Option<Self::Target>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, { ... } fn push<V>(&mut self, v: V) -> Result<(), AccessError>
where
V: Into<Self::Target>, { ... } fn try_push<V>(&mut self, v: V)
where
V: Into<Self::Target>, { ... } fn pop(&mut self) -> Result<Option<Self::Target>, AccessError> { ... } fn try_pop(&mut self) -> Option<Self::Target> { ... } fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Target>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, { ... } fn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target> { ... } }
Expand description
Mutatability for values
Required methods
fn as_array_mut(&mut self) -> Option<&mut Self::Array>[src]
Expand description
Tries to represent the value as an array and returns a mutable refference to it
fn as_object_mut(&mut self) -> Option<&mut Self::Object>[src]
Expand description
Tries to represent the value as an object and returns a mutable refference to it
Provided methods
fn insert<K, V>(
&mut self,
k: K,
v: V
) -> Result<Option<Self::Target>, AccessError> where
V: Into<Self::Target>,
K: Into<Self::Key>,
Self::Key: Hash,
Self::Key: Eq, [src]
&mut self,
k: K,
v: V
) -> Result<Option<Self::Target>, AccessError> where
V: Into<Self::Target>,
K: Into<Self::Key>,
Self::Key: Hash,
Self::Key: Eq,
Expand description
Insert into this Value as an Object.
Will return an AccessError::NotAnObject if called
on a Value that isn’t an object - otherwise will
behave the same as HashMap::insert
Errors
Will return Err if self is not an object.
fn try_insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Target> where
V: Into<Self::Target>,
K: Into<Self::Key>,
Self::Key: Hash,
Self::Key: Eq, [src]
V: Into<Self::Target>,
K: Into<Self::Key>,
Self::Key: Hash,
Self::Key: Eq,
Expand description
Tries to insert into this Value as an Object.
If the Value isn’t an object this opoeration will
return None and have no effect.
fn remove<Q>(&mut self, k: &Q) -> Result<Option<Self::Target>, AccessError> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Expand description
Remove from this Value as an Object.
Will return an AccessError::NotAnObject if called
on a Value that isn’t an object - otherwise will
behave the same as HashMap::remove
Errors
Will return Err if self is not an Object.
fn try_remove<Q>(&mut self, k: &Q) -> Option<Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Expand description
Tries to remove from this Value as an Object.
If the Value isn’t an object this opoeration will
return None and have no effect.
fn push<V>(&mut self, v: V) -> Result<(), AccessError> where
V: Into<Self::Target>, [src]
V: Into<Self::Target>,
Expand description
Pushes to this Value as an Array.
Will return an AccessError::NotAnArray if called
on a Value that isn’t an Array - otherwise will
behave the same as Vec::push
Errors
Will return Err if self is not an array.
fn try_push<V>(&mut self, v: V) where
V: Into<Self::Target>, [src]
V: Into<Self::Target>,
Expand description
Tries to push to a Value if as an Array.
This funciton will have no effect if Value is of
a different type
fn pop(&mut self) -> Result<Option<Self::Target>, AccessError>[src]
Expand description
Pops from this Value as an Array.
Will return an AccessError::NotAnArray if called
on a Value that isn’t an Array - otherwise will
behave the same as Vec::pop
Errors
Will return Err if self is not an array.
fn try_pop(&mut self) -> Option<Self::Target>[src]
Expand description
Tries to pop from a Value as an Array.
if the Value is any other type None will
always be returned
fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Expand description
Same as get but returns a mutable ref instead
fn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target>[src]
Expand description
Same as get_idx but returns a mutable ref instead