Trait simd_json::value::ValueAccess [−][src]
pub trait ValueAccess {
type Target: ValueAccess;
type Key: Hash + Eq;
type Array: Array;
type Object: Object;
Show methods
#[must_use]
fn as_bool(&self) -> Option<bool>;
#[must_use]
fn as_i64(&self) -> Option<i64>;
#[must_use]
fn as_u64(&self) -> Option<u64>;
#[must_use]
fn as_f64(&self) -> Option<f64>;
#[must_use]
fn as_str(&self) -> Option<&str>;
#[must_use]
fn as_array(&self) -> Option<&Self::Array>;
#[must_use]
fn as_object(&self) -> Option<&Self::Object>;
#[must_use]
fn get<Q>(&self, k: &Q) -> Option<&Self::Target>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn contains_key<Q>(&self, k: &Q) -> bool
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn get_idx(&self, i: usize) -> Option<&Self::Target> { ... }
#[must_use]
fn get_bool<Q>(&self, k: &Q) -> Option<bool>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_i128(&self) -> Option<i128> { ... }
#[must_use]
fn get_i128<Q>(&self, k: &Q) -> Option<i128>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn get_i64<Q>(&self, k: &Q) -> Option<i64>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_i32(&self) -> Option<i32> { ... }
#[must_use]
fn get_i32<Q>(&self, k: &Q) -> Option<i32>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_i16(&self) -> Option<i16> { ... }
#[must_use]
fn get_i16<Q>(&self, k: &Q) -> Option<i16>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_i8(&self) -> Option<i8> { ... }
#[must_use]
fn get_i8<Q>(&self, k: &Q) -> Option<i8>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_u128(&self) -> Option<u128> { ... }
#[must_use]
fn get_u128<Q>(&self, k: &Q) -> Option<u128>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn get_u64<Q>(&self, k: &Q) -> Option<u64>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_usize(&self) -> Option<usize> { ... }
#[must_use]
fn get_usize<Q>(&self, k: &Q) -> Option<usize>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_u32(&self) -> Option<u32> { ... }
#[must_use]
fn get_u32<Q>(&self, k: &Q) -> Option<u32>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_u16(&self) -> Option<u16> { ... }
#[must_use]
fn get_u16<Q>(&self, k: &Q) -> Option<u16>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn as_u8(&self) -> Option<u8> { ... }
#[must_use]
fn get_u8<Q>(&self, k: &Q) -> Option<u8>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn get_f64<Q>(&self, k: &Q) -> Option<f64>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn cast_f64(&self) -> Option<f64> { ... }
#[must_use]
fn as_f32(&self) -> Option<f32> { ... }
#[must_use]
fn get_f32<Q>(&self, k: &Q) -> Option<f32>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn get_str<Q>(&self, k: &Q) -> Option<&str>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn get_array<Q>(
&self,
k: &Q
) -> Option<&<Self::Target as ValueAccess>::Array>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
#[must_use]
fn get_object<Q>(
&self,
k: &Q
) -> Option<&<Self::Target as ValueAccess>::Object>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
}Expand description
Trait to allow accessing data inside a Value
Associated Types
Required methods
#[must_use]fn as_bool(&self) -> Option<bool>[src]
#[must_use]fn as_bool(&self) -> Option<bool>[src]Tries to represent the value as a bool
#[must_use]fn as_i64(&self) -> Option<i64>[src]
#[must_use]fn as_i64(&self) -> Option<i64>[src]Tries to represent the value as an i64
Provided methods
#[must_use]fn get<Q>(&self, k: &Q) -> Option<&Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get<Q>(&self, k: &Q) -> Option<&Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]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.
#[must_use]fn contains_key<Q>(&self, k: &Q) -> bool where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn contains_key<Q>(&self, k: &Q) -> bool where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Checks if a Value contains a given key. This will return flase if Value isn’t an object
#[must_use]fn get_idx(&self, i: usize) -> Option<&Self::Target>[src]
#[must_use]fn get_idx(&self, i: usize) -> Option<&Self::Target>[src]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.
#[must_use]fn get_bool<Q>(&self, k: &Q) -> Option<bool> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_bool<Q>(&self, k: &Q) -> Option<bool> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a bool
#[must_use]fn as_i128(&self) -> Option<i128>[src]
#[must_use]fn as_i128(&self) -> Option<i128>[src]Tries to represent the value as an i128
#[must_use]fn get_i128<Q>(&self, k: &Q) -> Option<i128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_i128<Q>(&self, k: &Q) -> Option<i128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a i128
#[must_use]fn get_i64<Q>(&self, k: &Q) -> Option<i64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_i64<Q>(&self, k: &Q) -> Option<i64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a i64
#[must_use]fn as_i32(&self) -> Option<i32>[src]
#[must_use]fn as_i32(&self) -> Option<i32>[src]Tries to represent the value as an i32
#[must_use]fn get_i32<Q>(&self, k: &Q) -> Option<i32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_i32<Q>(&self, k: &Q) -> Option<i32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a i32
#[must_use]fn as_i16(&self) -> Option<i16>[src]
#[must_use]fn as_i16(&self) -> Option<i16>[src]Tries to represent the value as an i16
#[must_use]fn get_i16<Q>(&self, k: &Q) -> Option<i16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_i16<Q>(&self, k: &Q) -> Option<i16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a i16
#[must_use]fn as_i8(&self) -> Option<i8>[src]
#[must_use]fn as_i8(&self) -> Option<i8>[src]Tries to represent the value as an i8
#[must_use]fn get_i8<Q>(&self, k: &Q) -> Option<i8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_i8<Q>(&self, k: &Q) -> Option<i8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a i8
#[must_use]fn as_u128(&self) -> Option<u128>[src]
#[must_use]fn as_u128(&self) -> Option<u128>[src]Tries to represent the value as an u128
#[must_use]fn get_u128<Q>(&self, k: &Q) -> Option<u128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_u128<Q>(&self, k: &Q) -> Option<u128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a u128
#[must_use]fn get_u64<Q>(&self, k: &Q) -> Option<u64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_u64<Q>(&self, k: &Q) -> Option<u64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a u64
#[must_use]fn as_usize(&self) -> Option<usize>[src]
#[must_use]fn as_usize(&self) -> Option<usize>[src]Tries to represent the value as an usize
#[must_use]fn get_usize<Q>(&self, k: &Q) -> Option<usize> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_usize<Q>(&self, k: &Q) -> Option<usize> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a usize
#[must_use]fn as_u32(&self) -> Option<u32>[src]
#[must_use]fn as_u32(&self) -> Option<u32>[src]Tries to represent the value as an u32
#[must_use]fn get_u32<Q>(&self, k: &Q) -> Option<u32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_u32<Q>(&self, k: &Q) -> Option<u32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a u32
#[must_use]fn as_u16(&self) -> Option<u16>[src]
#[must_use]fn as_u16(&self) -> Option<u16>[src]Tries to represent the value as an u16
#[must_use]fn get_u16<Q>(&self, k: &Q) -> Option<u16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_u16<Q>(&self, k: &Q) -> Option<u16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a u16
#[must_use]fn as_u8(&self) -> Option<u8>[src]
#[must_use]fn as_u8(&self) -> Option<u8>[src]Tries to represent the value as an u8
#[must_use]fn get_u8<Q>(&self, k: &Q) -> Option<u8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_u8<Q>(&self, k: &Q) -> Option<u8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a u8
#[must_use]fn get_f64<Q>(&self, k: &Q) -> Option<f64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_f64<Q>(&self, k: &Q) -> Option<f64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a f64
#[must_use]fn cast_f64(&self) -> Option<f64>[src]
#[must_use]fn cast_f64(&self) -> Option<f64>[src]Casts the current value to a f64 if possible, this will turn integer values into floats.
#[must_use]fn as_f32(&self) -> Option<f32>[src]
#[must_use]fn as_f32(&self) -> Option<f32>[src]Tries to represent the value as a f32
#[must_use]fn get_f32<Q>(&self, k: &Q) -> Option<f32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_f32<Q>(&self, k: &Q) -> Option<f32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a f32
#[must_use]fn get_str<Q>(&self, k: &Q) -> Option<&str> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]
#[must_use]fn get_str<Q>(&self, k: &Q) -> Option<&str> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq, [src]Tries to get an element of an object as a str
Implementations on Foreign Types
impl<V> ValueAccess for Option<V> where
V: ValueAccess, [src]
impl<V> ValueAccess for Option<V> where
V: ValueAccess, [src]type Target = <V as ValueAccess>::Target
type Key = <V as ValueAccess>::Key
type Array = <V as ValueAccess>::Array
type Object = <V as ValueAccess>::Object
pub fn as_bool(&self) -> Option<bool>[src]
pub fn as_i64(&self) -> Option<i64>[src]
pub fn as_u64(&self) -> Option<u64>[src]
pub fn as_f64(&self) -> Option<f64>[src]
pub fn as_str(&self) -> Option<&str>[src]
pub fn as_array(&self) -> Option<&<Option<V> as ValueAccess>::Array>[src]
pub fn as_object(&self) -> Option<&<Option<V> as ValueAccess>::Object>[src]
impl<V, E> ValueAccess for Result<V, E> where
V: ValueAccess, [src]
impl<V, E> ValueAccess for Result<V, E> where
V: ValueAccess, [src]type Target = <V as ValueAccess>::Target
type Key = <V as ValueAccess>::Key
type Array = <V as ValueAccess>::Array
type Object = <V as ValueAccess>::Object
pub fn as_bool(&self) -> Option<bool>[src]
pub fn as_i64(&self) -> Option<i64>[src]
pub fn as_u64(&self) -> Option<u64>[src]
pub fn as_f64(&self) -> Option<f64>[src]
pub fn as_str(&self) -> Option<&str>[src]
pub fn as_array(&self) -> Option<&<Result<V, E> as ValueAccess>::Array>[src]
pub fn as_object(&self) -> Option<&<Result<V, E> as ValueAccess>::Object>[src]
Implementors
impl ValueAccess for StaticNode[src]
impl ValueAccess for StaticNode[src]type Target = StaticNode
type Key = String
type Array = Vec<StaticNode, Global>
type Object = HashMap<String, StaticNode, RandomState>
#[must_use]pub fn as_array(&self) -> Option<&<StaticNode as ValueAccess>::Array>[src]
#[must_use]pub fn as_object(
&self
) -> Option<&HashMap<<StaticNode as ValueAccess>::Key, StaticNode, RandomState>>[src]
&self
) -> Option<&HashMap<<StaticNode as ValueAccess>::Key, StaticNode, RandomState>>
#[must_use]pub fn as_bool(&self) -> Option<bool>[src]
#[must_use]pub fn as_i64(&self) -> Option<i64>[src]
#[must_use]pub fn as_u64(&self) -> Option<u64>[src]
#[must_use]pub fn as_f64(&self) -> Option<f64>[src]
#[must_use]pub fn cast_f64(&self) -> Option<f64>[src]
#[must_use]pub fn as_str(&self) -> Option<&str>[src]
impl ValueAccess for simd_json::value::owned::Value[src]
impl ValueAccess for simd_json::value::owned::Value[src]type Target = Value
type Key = String
type Array = Vec<Self>
type Object = HashMap<Self::Key, Self>
#[must_use]fn as_bool(&self) -> Option<bool>[src]
#[must_use]fn as_i64(&self) -> Option<i64>[src]
#[must_use]fn as_i128(&self) -> Option<i128>[src]
#[must_use]fn as_u64(&self) -> Option<u64>[src]
#[must_use]fn as_f64(&self) -> Option<f64>[src]
#[must_use]fn cast_f64(&self) -> Option<f64>[src]
#[must_use]fn as_str(&self) -> Option<&str>[src]
#[must_use]fn as_array(&self) -> Option<&Vec<Self>>[src]
#[must_use]fn as_object(&self) -> Option<&HashMap<Self::Key, Self>>[src]
impl<'value> ValueAccess for simd_json::value::borrowed::Value<'value>[src]
impl<'value> ValueAccess for simd_json::value::borrowed::Value<'value>[src]