Trait simd_json::prelude::ValueAccess [−][src]
Prelude to include needed traits Trait to allow accessing data inside a Value
Associated Types
type Target: ValueAccess
[src]
The target for nested lookups
type Key: Hash + Eq
[src]
The type for Objects
type Array: Array
[src]
The array structure
type Object: Object
[src]
The object structure
Required methods
#[must_use]pub fn as_bool(&self) -> Option<bool>
[src]
Tries to represent the value as a bool
#[must_use]pub fn as_i64(&self) -> Option<i64>
[src]
Tries to represent the value as an i64
#[must_use]pub fn as_u64(&self) -> Option<u64>
[src]
Tries to represent the value as an u64
#[must_use]pub fn as_f64(&self) -> Option<f64>
[src]
Tries to represent the value as a f64
#[must_use]pub fn as_str(&self) -> Option<&str>
[src]
Tries to represent the value as a &str
#[must_use]pub fn as_array(&self) -> Option<&Self::Array>
[src]
Tries to represent the value as an array and returns a refference to it
#[must_use]pub fn as_object(&self) -> Option<&Self::Object>
[src]
Tries to represent the value as an object and returns a refference to it
Provided methods
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
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]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Checks if a Value contains a given key. This will return flase if Value isn’t an object
#[must_use]pub 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]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a bool
#[must_use]pub fn as_i128(&self) -> Option<i128>
[src]
Tries to represent the value as an i128
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i128
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i64
#[must_use]pub fn as_i32(&self) -> Option<i32>
[src]
Tries to represent the value as an i32
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i32
#[must_use]pub fn as_i16(&self) -> Option<i16>
[src]
Tries to represent the value as an i16
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i16
#[must_use]pub fn as_i8(&self) -> Option<i8>
[src]
Tries to represent the value as an i8
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i8
#[must_use]pub fn as_u128(&self) -> Option<u128>
[src]
Tries to represent the value as an u128
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u128
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u64
#[must_use]pub fn as_usize(&self) -> Option<usize>
[src]
Tries to represent the value as an usize
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a usize
#[must_use]pub fn as_u32(&self) -> Option<u32>
[src]
Tries to represent the value as an u32
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u32
#[must_use]pub fn as_u16(&self) -> Option<u16>
[src]
Tries to represent the value as an u16
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u16
#[must_use]pub fn as_u8(&self) -> Option<u8>
[src]
Tries to represent the value as an u8
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u8
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a f64
#[must_use]pub 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]pub fn as_f32(&self) -> Option<f32>
[src]
Tries to represent the value as a f32
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a f32
#[must_use]pub 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]
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a str
#[must_use]pub 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,
[src]
&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,
Tries to get an element of an object as a array
#[must_use]pub 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,
[src]
&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,
Tries to get an element of an object as a object
Implementations on Foreign Types
impl<V, E> ValueAccess for Result<V, E> where
V: ValueAccess,
[src]
V: ValueAccess,
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]
impl<V> ValueAccess for Option<V> where
V: ValueAccess,
[src]
V: ValueAccess,
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]
Implementors
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>>