Trait value_trait::Mutable [−][src]
Mutatability for values
Required methods
fn as_array_mut(&mut self) -> Option<&mut Self::Array>
[src]
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]
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
K: Into<Self::Key>,
V: Into<Self::Target>,
Self::Key: Hash + Eq,
[src]
&mut self,
k: K,
v: V
) -> Result<Option<Self::Target>, AccessError> where
K: Into<Self::Key>,
V: Into<Self::Target>,
Self::Key: Hash + Eq,
Tries to 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 remove<Q: ?Sized>(
&mut self,
k: &Q
) -> Result<Option<Self::Target>, AccessError> where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
[src]
&mut self,
k: &Q
) -> Result<Option<Self::Target>, AccessError> where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to 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 push<V>(&mut self, v: V) -> Result<(), AccessError> where
V: Into<Self::Target>,
[src]
V: Into<Self::Target>,
Tries to push 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 pop(&mut self) -> Result<Option<Self::Target>, AccessError>
[src]
Tries to pop 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 get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut Self::Target> where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
[src]
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Same as get
but returns a mutable ref instead
fn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target>
[src]
Same as get_idx
but returns a mutable ref instead