Trait simd_json::value::ValueAccess
source · [−]pub trait ValueAccess {
type Target: ValueAccess;
type Key: Hash + Eq;
type Array: Array
where
<Self::Array as Array>::Element == Self::Target;
type Object: Object
where
<Self::Object as Object>::Key == Self::Key,
<Self::Object as Object>::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>(&self, k: &Q) -> Option<&Self::Target>
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
fn contains_key<Q>(&self, k: &Q) -> bool
where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
{ ... }
fn get_idx(&self, i: usize) -> Option<&Self::Target> { ... }
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,
{ ... }
fn as_i128(&self) -> Option<i128> { ... }
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,
{ ... }
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,
{ ... }
fn as_i32(&self) -> Option<i32> { ... }
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,
{ ... }
fn as_i16(&self) -> Option<i16> { ... }
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,
{ ... }
fn as_i8(&self) -> Option<i8> { ... }
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,
{ ... }
fn as_u128(&self) -> Option<u128> { ... }
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,
{ ... }
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,
{ ... }
fn as_usize(&self) -> Option<usize> { ... }
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,
{ ... }
fn as_u32(&self) -> Option<u32> { ... }
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,
{ ... }
fn as_u16(&self) -> Option<u16> { ... }
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,
{ ... }
fn as_u8(&self) -> Option<u8> { ... }
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,
{ ... }
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,
{ ... }
fn cast_f64(&self) -> Option<f64> { ... }
fn as_f32(&self) -> Option<f32> { ... }
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,
{ ... }
fn as_char(&self) -> Option<char> { ... }
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,
{ ... }
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,
{ ... }
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
Required Associated Types
type Target: ValueAccess
type Target: ValueAccess
The target for nested lookups
Required Methods
Tries to represent the value as an array 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 get an element of an object as a i128
Tries to get an element of an object as a i64
Tries to get an element of an object as a i32
Tries to get an element of an object as a i16
Tries to get an element of an object as a i8
Tries to get an element of an object as a u128
Tries to get an element of an object as a u64
Tries to get an element of an object as a usize
Tries to get an element of an object as a u32
Tries to get an element of an object as a u16
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 get an element of an object as a f32
Tries to get an element of an object as a str
Tries to get an element of an object as a array