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: Hash + Eq + Ord + ?Sized;
    fn try_get_object<Q>(
        &self,
        k: &Q,
    ) -> Result<Option<&Self::Object>, TryTypeError>
       where Self::Key: Borrow<Q> + Hash + Eq,
             Q: Hash + Eq + Ord + ?Sized;
}
Expand description

try_as_* access to container values in an object

Required Associated Types§

source

type Key: ?Sized

The type for Objects

source

type Target

The target for nested lookups

source

type Array: Array

The array structure

source

type Object: Object

The object structure

Required Methods§

source

fn try_get_array<Q>(&self, k: &Q) -> Result<Option<&Self::Array>, TryTypeError>
where Self::Key: Borrow<Q> + Hash + Eq, Q: Hash + Eq + Ord + ?Sized,

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

source

fn try_get_object<Q>( &self, k: &Q, ) -> Result<Option<&Self::Object>, TryTypeError>
where Self::Key: Borrow<Q> + Hash + Eq, Q: Hash + Eq + Ord + ?Sized,

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.

Implementors§