pub trait ValueObjectAccessTryAsScalar {
type Key: ?Sized;
Show 15 methods
// Required methods
fn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn try_get_str<Q>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
}
Expand description
try_as_*
access to scalar values in an object
Required Associated Types§
Required Methods§
Sourcefn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
fn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
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 try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
fn try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
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 try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
fn try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
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 try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
fn try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
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 try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
fn try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
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 try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
fn try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
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 try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
fn try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
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 try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
fn try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
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 try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
fn try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
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 try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
fn try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
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 try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
fn try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
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 try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
fn try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
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 try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
fn try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
Tries to get an element of an object as a f64, returns an error if it isn’t a f64
§Errors
if the requested type doesn’t match the actual type or the value is not an object
Sourcefn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
fn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
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 try_get_str<Q>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>
fn try_get_str<Q>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.