pub trait ValueAccess: Sized {
    type Target: ValueAccess;
    type Key: Hash + Eq;
    type Array: Array<Element = Self::Target>;
    type Object: Object<Key = Self::Key, Element = Self::Target>;
Show 39 methods fn as_bool(&self) -> Option<bool>;
fn as_i64(&self) -> Option<i64>;
fn as_u64(&self) -> Option<u64>;
fn as_f64(&self) -> Option<f64>;
fn as_str(&self) -> Option<&str>;
fn as_array(&self) -> Option<&Self::Array>;
fn as_object(&self) -> Option<&Self::Object>; fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self::Target>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn get_idx(&self, i: usize) -> Option<&Self::Target> { ... }
fn get_bool<Q: ?Sized>(&self, k: &Q) -> Option<bool>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_i128(&self) -> Option<i128> { ... }
fn get_i128<Q: ?Sized>(&self, k: &Q) -> Option<i128>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn get_i64<Q: ?Sized>(&self, k: &Q) -> Option<i64>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_i32(&self) -> Option<i32> { ... }
fn get_i32<Q: ?Sized>(&self, k: &Q) -> Option<i32>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_i16(&self) -> Option<i16> { ... }
fn get_i16<Q: ?Sized>(&self, k: &Q) -> Option<i16>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_i8(&self) -> Option<i8> { ... }
fn get_i8<Q: ?Sized>(&self, k: &Q) -> Option<i8>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_u128(&self) -> Option<u128> { ... }
fn get_u128<Q: ?Sized>(&self, k: &Q) -> Option<u128>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn get_u64<Q: ?Sized>(&self, k: &Q) -> Option<u64>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_usize(&self) -> Option<usize> { ... }
fn get_usize<Q: ?Sized>(&self, k: &Q) -> Option<usize>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_u32(&self) -> Option<u32> { ... }
fn get_u32<Q: ?Sized>(&self, k: &Q) -> Option<u32>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_u16(&self) -> Option<u16> { ... }
fn get_u16<Q: ?Sized>(&self, k: &Q) -> Option<u16>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_u8(&self) -> Option<u8> { ... }
fn get_u8<Q: ?Sized>(&self, k: &Q) -> Option<u8>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn get_f64<Q: ?Sized>(&self, k: &Q) -> Option<f64>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn cast_f64(&self) -> Option<f64> { ... }
fn as_f32(&self) -> Option<f32> { ... }
fn get_f32<Q: ?Sized>(&self, k: &Q) -> Option<f32>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn as_char(&self) -> Option<char> { ... }
fn get_str<Q: ?Sized>(&self, k: &Q) -> Option<&str>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn get_array<Q: ?Sized>(
        &self,
        k: &Q
    ) -> Option<&<<Self as ValueAccess>::Target as ValueAccess>::Array>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
fn get_object<Q: ?Sized>(
        &self,
        k: &Q
    ) -> Option<&<<Self as ValueAccess>::Target as ValueAccess>::Object>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
, { ... }
}
Expand description

Trait to allow accessing data inside a Value

Associated Types

The target for nested lookups

The type for Objects

The array structure

The object structure

Required methods

Tries to represent the value as a bool

Tries to represent the value as an i64

Tries to represent the value as an u64

Tries to represent the value as a f64

Tries to represent the value as a &str

Tries to represent the value as an array and returns a refference to it

Tries to represent the value as an object and returns a refference to it

Provided methods

Gets a ref to a value based on a key, returns None if the current Value isn’t an Object or doesn’t contain the key it was asked for.

Checks if a Value contains a given key. This will return flase if Value isn’t an object

Gets a ref to a value based on n index, returns None if the current Value isn’t an Array or doesn’t contain the index it was asked for.

Tries to get an element of an object as a bool

Tries to represent the value as an i128

Tries to get an element of an object as a i128

Tries to get an element of an object as a i64

Tries to represent the value as an i32

Tries to get an element of an object as a i32

Tries to represent the value as an i16

Tries to get an element of an object as a i16

Tries to represent the value as an i8

Tries to get an element of an object as a i8

Tries to represent the value as an u128

Tries to get an element of an object as a u128

Tries to get an element of an object as a u64

Tries to represent the value as an usize

Tries to get an element of an object as a usize

Tries to represent the value as an u32

Tries to get an element of an object as a u32

Tries to represent the value as an u16

Tries to get an element of an object as a u16

Tries to represent the value as an u8

Tries to get an element of an object as a u8

Tries to get an element of an object as a f64

Casts the current value to a f64 if possible, this will turn integer values into floats.

Tries to represent the value as a f32

Tries to get an element of an object as a f32

Tries to represent the value as a Char

Tries to get an element of an object as a str

Tries to get an element of an object as a array

Tries to get an element of an object as a object

Implementations on Foreign Types

Implementors