Trait simd_json::value::Mutable[][src]

pub trait Mutable: IndexMut<usize> + Value {
    pub fn as_array_mut(&mut self) -> Option<&mut Self::Array>;
pub fn as_object_mut(&mut self) -> Option<&mut Self::Object>; pub 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
, { ... }
pub 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
, { ... }
pub fn push<V>(&mut self, v: V) -> Result<(), AccessError>
    where
        V: Into<Self::Target>
, { ... }
pub fn pop(&mut self) -> Result<Option<Self::Target>, AccessError> { ... }
pub 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
, { ... }
pub fn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target> { ... } }

Mutatability for values

Required methods

pub 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

pub 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

Loading content...

Provided methods

pub 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]

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.

pub 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]

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.

pub fn push<V>(&mut self, v: V) -> Result<(), AccessError> where
    V: Into<Self::Target>, 
[src]

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.

pub 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.

pub 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]

Same as get but returns a mutable ref instead

pub fn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target>[src]

Same as get_idx but returns a mutable ref instead

Loading content...

Implementors

impl Mutable for simd_json::value::owned::Value[src]

impl<'value> Mutable for simd_json::value::borrowed::Value<'value>[src]

Loading content...