pub trait ValueObjectAccessTryAsContainer {
type Key: ?Sized;
type Target;
type Array: Array;
type Object: Object;
// Required methods
fn try_get_array<Q>(
&self,
k: &Q
) -> Result<Option<&Self::Array>, TryTypeError>
where Self::Key: Borrow<Q> + Hash + Eq,
Q: ?Sized + Hash + Eq + Ord;
fn try_get_object<Q>(
&self,
k: &Q
) -> Result<Option<&Self::Object>, TryTypeError>
where Self::Key: Borrow<Q> + Hash + Eq,
Q: ?Sized + Hash + Eq + Ord;
}
Expand description
try_as_*
access to container values in an object
Required Associated Types§
Required Methods§
sourcefn try_get_array<Q>(&self, k: &Q) -> Result<Option<&Self::Array>, TryTypeError>
fn try_get_array<Q>(&self, k: &Q) -> Result<Option<&Self::Array>, TryTypeError>
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 try_get_object<Q>(
&self,
k: &Q
) -> Result<Option<&Self::Object>, TryTypeError>
fn try_get_object<Q>( &self, k: &Q ) -> Result<Option<&Self::Object>, TryTypeError>
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
Object Safety§
This trait is not object safe.