pub trait ValueExt: Sized {
    fn insert(
        &mut self,
        key: String,
        value: impl Into<Self>
    ) -> Result<Option<Self>, Error>; fn pointer(&self, pointer: &Pointer<'_>) -> Option<&Self>; fn pointer_mut(&mut self, pointer: &Pointer<'_>) -> Option<&mut Self>; fn insert_at(
        &mut self,
        pointer: &Pointer<'_>,
        value: impl Into<Self>
    ) -> Result<Option<Self>, Error> { ... } }
Expand description

An extension trait for any JSON value representation that provides a variety of manipulation methods.

Required Methods

Insert any data in the current JSON value.

If the JSON value already contains the given key, it will be overrided.

Errors

This method may fail if the current JSON value is not a JSON object.

Looks up a value by a JSON pointer.

Looks up a value by a JSON pointer and returns a mutable reference to that value.

Provided Methods

Inserts any data at the given pointee JSON value.

If the JSON pointer’s key already exists in the JSON pointee value, it will be overrided.

Arguments
  • pointer: A JSON pointer.
  • value: A data to insert at the pointee JSON value.
Errors

This method may fail if the pointee JSON value is not a JSON object or if it does not exist.

Implementors