Trait value_trait::ValueAccess
source · 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 78 methods
fn value_type(&self) -> ValueType;
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 try_as_bool(&self) -> Result<bool, TryTypeError> { ... }
fn as_i128(&self) -> Option<i128> { ... }
fn try_as_i128(&self) -> Result<i128, TryTypeError> { ... }
fn try_as_i64(&self) -> Result<i64, TryTypeError> { ... }
fn as_i32(&self) -> Option<i32> { ... }
fn try_as_i32(&self) -> Result<i32, TryTypeError> { ... }
fn as_i16(&self) -> Option<i16> { ... }
fn try_as_i16(&self) -> Result<i16, TryTypeError> { ... }
fn as_i8(&self) -> Option<i8> { ... }
fn try_as_i8(&self) -> Result<i8, TryTypeError> { ... }
fn as_u128(&self) -> Option<u128> { ... }
fn try_as_u128(&self) -> Result<u128, TryTypeError> { ... }
fn try_as_u64(&self) -> Result<u64, TryTypeError> { ... }
fn as_usize(&self) -> Option<usize> { ... }
fn try_as_usize(&self) -> Result<usize, TryTypeError> { ... }
fn as_u32(&self) -> Option<u32> { ... }
fn try_as_u32(&self) -> Result<u32, TryTypeError> { ... }
fn as_u16(&self) -> Option<u16> { ... }
fn try_as_u16(&self) -> Result<u16, TryTypeError> { ... }
fn as_u8(&self) -> Option<u8> { ... }
fn try_as_u8(&self) -> Result<u8, TryTypeError> { ... }
fn try_as_f64(&self) -> Result<f64, TryTypeError> { ... }
fn cast_f64(&self) -> Option<f64> { ... }
fn try_cast_f64(&self) -> Result<f64, TryTypeError> { ... }
fn as_f32(&self) -> Option<f32> { ... }
fn try_as_f32(&self) -> Result<f32, TryTypeError> { ... }
fn try_as_str(&self) -> Result<&str, TryTypeError> { ... }
fn as_char(&self) -> Option<char> { ... }
fn try_as_char(&self) -> Result<char, TryTypeError> { ... }
fn try_as_array(&self) -> Result<&Self::Array, TryTypeError> { ... }
fn try_as_object(&self) -> Result<&Self::Object, TryTypeError> { ... }
fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self::Target>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&Self::Target>, TryTypeError>
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 try_get_idx(
&self,
i: usize
) -> Result<Option<&Self::Target>, TryTypeError> { ... }
fn get_bool<Q: ?Sized>(&self, k: &Q) -> Option<bool>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_bool<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<bool>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_i128<Q: ?Sized>(&self, k: &Q) -> Option<i128>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_i128<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<i128>, TryTypeError>
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 try_get_i64<Q: ?Sized>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_i32<Q: ?Sized>(&self, k: &Q) -> Option<i32>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_i32<Q: ?Sized>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_i16<Q: ?Sized>(&self, k: &Q) -> Option<i16>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_i16<Q: ?Sized>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_i8<Q: ?Sized>(&self, k: &Q) -> Option<i8>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_i8<Q: ?Sized>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_u128<Q: ?Sized>(&self, k: &Q) -> Option<u128>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_u128<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<u128>, TryTypeError>
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 try_get_u64<Q: ?Sized>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_usize<Q: ?Sized>(&self, k: &Q) -> Option<usize>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_usize<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<usize>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_u32<Q: ?Sized>(&self, k: &Q) -> Option<u32>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_u32<Q: ?Sized>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_u16<Q: ?Sized>(&self, k: &Q) -> Option<u16>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_u16<Q: ?Sized>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_u8<Q: ?Sized>(&self, k: &Q) -> Option<u8>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_u8<Q: ?Sized>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
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 try_get_f64<Q: ?Sized>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_f32<Q: ?Sized>(&self, k: &Q) -> Option<f32>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_f32<Q: ?Sized>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn get_str<Q: ?Sized>(&self, k: &Q) -> Option<&str>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
fn try_get_str<Q: ?Sized>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>
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 try_get_array<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&<<Self as ValueAccess>::Target as ValueAccess>::Array>, TryTypeError>
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,
{ ... }
fn try_get_object<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&<<Self as ValueAccess>::Target as ValueAccess>::Object>, TryTypeError>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
{ ... }
}
Expand description
Trait to allow accessing data inside a Value
Required Associated Types
sourcetype Target: ValueAccess
type Target: ValueAccess
The target for nested lookups
Required Methods
sourcefn value_type(&self) -> ValueType
fn value_type(&self) -> ValueType
Gets the type of the current value
Provided Methods
sourcefn try_as_bool(&self) -> Result<bool, TryTypeError>
fn try_as_bool(&self) -> Result<bool, TryTypeError>
sourcefn try_as_i128(&self) -> Result<i128, TryTypeError>
fn try_as_i128(&self) -> Result<i128, TryTypeError>
sourcefn try_as_i64(&self) -> Result<i64, TryTypeError>
fn try_as_i64(&self) -> Result<i64, TryTypeError>
sourcefn try_as_i32(&self) -> Result<i32, TryTypeError>
fn try_as_i32(&self) -> Result<i32, TryTypeError>
sourcefn try_as_i16(&self) -> Result<i16, TryTypeError>
fn try_as_i16(&self) -> Result<i16, TryTypeError>
sourcefn try_as_i8(&self) -> Result<i8, TryTypeError>
fn try_as_i8(&self) -> Result<i8, TryTypeError>
sourcefn try_as_u128(&self) -> Result<u128, TryTypeError>
fn try_as_u128(&self) -> Result<u128, TryTypeError>
sourcefn try_as_u64(&self) -> Result<u64, TryTypeError>
fn try_as_u64(&self) -> Result<u64, TryTypeError>
sourcefn try_as_usize(&self) -> Result<usize, TryTypeError>
fn try_as_usize(&self) -> Result<usize, TryTypeError>
sourcefn try_as_u32(&self) -> Result<u32, TryTypeError>
fn try_as_u32(&self) -> Result<u32, TryTypeError>
sourcefn try_as_u16(&self) -> Result<u16, TryTypeError>
fn try_as_u16(&self) -> Result<u16, TryTypeError>
sourcefn try_as_u8(&self) -> Result<u8, TryTypeError>
fn try_as_u8(&self) -> Result<u8, TryTypeError>
sourcefn try_as_f64(&self) -> Result<f64, TryTypeError>
fn try_as_f64(&self) -> Result<f64, TryTypeError>
sourcefn cast_f64(&self) -> Option<f64>
fn cast_f64(&self) -> Option<f64>
Casts the current value to a f64 if possible, this will turn integer values into floats.
sourcefn try_cast_f64(&self) -> Result<f64, TryTypeError>
fn try_cast_f64(&self) -> Result<f64, TryTypeError>
Tries to Casts the current value to a f64 if possible, this will turn integer values into floats and error if it isn’t possible
Errors
if the requested type doesn’t match the actual type
sourcefn try_as_f32(&self) -> Result<f32, TryTypeError>
fn try_as_f32(&self) -> Result<f32, TryTypeError>
sourcefn try_as_str(&self) -> Result<&str, TryTypeError>
fn try_as_str(&self) -> Result<&str, TryTypeError>
sourcefn try_as_char(&self) -> Result<char, TryTypeError>
fn try_as_char(&self) -> Result<char, TryTypeError>
sourcefn try_as_array(&self) -> Result<&Self::Array, TryTypeError>
fn try_as_array(&self) -> Result<&Self::Array, TryTypeError>
Tries to represent the value as an array and returns a refference to it
Errors
if the requested type doesn’t match the actual type
sourcefn try_as_object(&self) -> Result<&Self::Object, TryTypeError>
fn try_as_object(&self) -> Result<&Self::Object, TryTypeError>
Tries to represent the value as an object and returns a refference to it
Errors
if the requested type doesn’t match the actual type
sourcefn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self::Target>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self::Target>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
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.
sourcefn try_get<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&Self::Target>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&Self::Target>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Trys to get a value based on a key, returns a TryTypeError
if the
current Value isn’t an Object, returns None
if the key isn’t in the object
Errors
if the value is not an object
sourcefn contains_key<Q: ?Sized>(&self, k: &Q) -> boolwhere
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn contains_key<Q: ?Sized>(&self, k: &Q) -> boolwhere
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Checks if a Value contains a given key. This will return flase if Value isn’t an object
sourcefn get_idx(&self, i: usize) -> Option<&Self::Target>
fn get_idx(&self, i: usize) -> Option<&Self::Target>
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.
sourcefn try_get_idx(&self, i: usize) -> Result<Option<&Self::Target>, TryTypeError>
fn try_get_idx(&self, i: usize) -> Result<Option<&Self::Target>, TryTypeError>
Tries to get a value based on n index, returns a type error if the
current value isn’t an Array, returns None
if the index is out of bouds
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_bool<Q: ?Sized>(&self, k: &Q) -> Option<bool>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_bool<Q: ?Sized>(&self, k: &Q) -> Option<bool>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a bool
sourcefn try_get_bool<Q: ?Sized>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_bool<Q: ?Sized>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a bool, returns an error if it isn’t bool
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_i128<Q: ?Sized>(&self, k: &Q) -> Option<i128>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_i128<Q: ?Sized>(&self, k: &Q) -> Option<i128>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i128
sourcefn try_get_i128<Q: ?Sized>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_i128<Q: ?Sized>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i128, returns an error if it isn’t i128
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_i64<Q: ?Sized>(&self, k: &Q) -> Option<i64>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,
Tries to get an element of an object as a i64
sourcefn try_get_i64<Q: ?Sized>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_i64<Q: ?Sized>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i64, returns an error if it isn’t a i64
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_i32<Q: ?Sized>(&self, k: &Q) -> Option<i32>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_i32<Q: ?Sized>(&self, k: &Q) -> Option<i32>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i32
sourcefn try_get_i32<Q: ?Sized>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_i32<Q: ?Sized>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i32, returns an error if it isn’t a i32
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_i16<Q: ?Sized>(&self, k: &Q) -> Option<i16>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_i16<Q: ?Sized>(&self, k: &Q) -> Option<i16>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i16
sourcefn try_get_i16<Q: ?Sized>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_i16<Q: ?Sized>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i16, returns an error if it isn’t a i16
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_i8<Q: ?Sized>(&self, k: &Q) -> Option<i8>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_i8<Q: ?Sized>(&self, k: &Q) -> Option<i8>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i8
sourcefn try_get_i8<Q: ?Sized>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_i8<Q: ?Sized>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a i8, returns an error if it isn’t a i8
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_u128<Q: ?Sized>(&self, k: &Q) -> Option<u128>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_u128<Q: ?Sized>(&self, k: &Q) -> Option<u128>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u128
sourcefn try_get_u128<Q: ?Sized>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_u128<Q: ?Sized>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u128, returns an error if it isn’t a u128
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_u64<Q: ?Sized>(&self, k: &Q) -> Option<u64>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,
Tries to get an element of an object as a u64
sourcefn try_get_u64<Q: ?Sized>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_u64<Q: ?Sized>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u64, returns an error if it isn’t a u64
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_usize<Q: ?Sized>(&self, k: &Q) -> Option<usize>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_usize<Q: ?Sized>(&self, k: &Q) -> Option<usize>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a usize
sourcefn try_get_usize<Q: ?Sized>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_usize<Q: ?Sized>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a usize, returns an error if it isn’t a usize
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_u32<Q: ?Sized>(&self, k: &Q) -> Option<u32>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_u32<Q: ?Sized>(&self, k: &Q) -> Option<u32>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u32
sourcefn try_get_u32<Q: ?Sized>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_u32<Q: ?Sized>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u32, returns an error if it isn’t a u32
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_u16<Q: ?Sized>(&self, k: &Q) -> Option<u16>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_u16<Q: ?Sized>(&self, k: &Q) -> Option<u16>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u16
sourcefn try_get_u16<Q: ?Sized>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_u16<Q: ?Sized>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u16, returns an error if it isn’t a u16
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_u8<Q: ?Sized>(&self, k: &Q) -> Option<u8>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_u8<Q: ?Sized>(&self, k: &Q) -> Option<u8>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u8
sourcefn try_get_u8<Q: ?Sized>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_u8<Q: ?Sized>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u8, returns an error if it isn’t a u8
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_f64<Q: ?Sized>(&self, k: &Q) -> Option<f64>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,
Tries to get an element of an object as a f64
sourcefn try_get_f64<Q: ?Sized>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_f64<Q: ?Sized>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a u8, returns an error if it isn’t a u8
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_f32<Q: ?Sized>(&self, k: &Q) -> Option<f32>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_f32<Q: ?Sized>(&self, k: &Q) -> Option<f32>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a f32
sourcefn try_get_f32<Q: ?Sized>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_f32<Q: ?Sized>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a f32, returns an error if it isn’t a f32
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn get_str<Q: ?Sized>(&self, k: &Q) -> Option<&str>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn get_str<Q: ?Sized>(&self, k: &Q) -> Option<&str>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a str
sourcefn try_get_str<Q: ?Sized>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_str<Q: ?Sized>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as a str, returns an error if it isn’t a str
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn 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_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,
Tries to get an element of an object as a array
sourcefn try_get_array<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&<<Self as ValueAccess>::Target as ValueAccess>::Array>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_array<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&<<Self as ValueAccess>::Target as ValueAccess>::Array>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as an array, returns an error if it isn’t a array
Errors
if the requested type doesn’t match the actual type or the value is not an object
sourcefn 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,
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,
Tries to get an element of an object as a object
sourcefn try_get_object<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&<<Self as ValueAccess>::Target as ValueAccess>::Object>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
fn try_get_object<Q: ?Sized>(
&self,
k: &Q
) -> Result<Option<&<<Self as ValueAccess>::Target as ValueAccess>::Object>, TryTypeError>where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord,
Tries to get an element of an object as an object, returns an error if it isn’t an object
Errors
if the requested type doesn’t match the actual type or the value is not an object