pub trait IndexOrKey {
// Required methods
fn get(self, value: &Value) -> Option<&Value>;
fn get_mut(self, value: &mut Value) -> Option<&mut Value>;
fn get_or_insert(self, value: &mut Value) -> &mut Value;
}Required Methods§
Sourcefn get_or_insert(self, value: &mut Value) -> &mut Value
fn get_or_insert(self, value: &mut Value) -> &mut Value
Get a mutable reference or insert Value::Null and return a mutable reference to that.
Implementations on Foreign Types§
Source§impl IndexOrKey for &str
impl IndexOrKey for &str
Source§fn get(self, value: &Value) -> Option<&Value>
fn get(self, value: &Value) -> Option<&Value>
Get an immutable reference to a Value in a Value::Object.
Source§fn get_mut(self, value: &mut Value) -> Option<&mut Value>
fn get_mut(self, value: &mut Value) -> Option<&mut Value>
Get a mutable reference to a Value in a Value::Object.
Source§fn get_or_insert(self, value: &mut Value) -> &mut Value
fn get_or_insert(self, value: &mut Value) -> &mut Value
Get a mutable reference to a Value in a Value::Object if it exists, otherwise insert Value::Null and return a mutable reference to that.
Source§impl IndexOrKey for usize
impl IndexOrKey for usize
Source§fn get(self, value: &Value) -> Option<&Value>
fn get(self, value: &Value) -> Option<&Value>
Get an immutable reference to a Value in a Value::Array.
Source§fn get_mut(self, value: &mut Value) -> Option<&mut Value>
fn get_mut(self, value: &mut Value) -> Option<&mut Value>
Get an immutable reference to a Value in a Value::Array.
Source§fn get_or_insert(self, _value: &mut Value) -> &mut Value
fn get_or_insert(self, _value: &mut Value) -> &mut Value
Get a mutable refence to a Value in a Value::Array. This function will panic if the Value is not an array.
Source§impl IndexOrKey for String
impl IndexOrKey for String
Source§fn get(self, value: &Value) -> Option<&Value>
fn get(self, value: &Value) -> Option<&Value>
Get an immutable reference to a Value in a Value::Object.
Source§fn get_mut(self, value: &mut Value) -> Option<&mut Value>
fn get_mut(self, value: &mut Value) -> Option<&mut Value>
Get a mutable reference to a Value in a Value::Object.
Source§fn get_or_insert(self, value: &mut Value) -> &mut Value
fn get_or_insert(self, value: &mut Value) -> &mut Value
Get a mutable reference to a Value in a Value::Object if it exists, otherwise insert Value::Null and return a mutable reference to that.