simd_json::prelude

Trait ValueObjectTryAccess

Source
pub trait ValueObjectTryAccess {
    type Key: ?Sized;
    type Target;

    // Required method
    fn try_get<Q>(&self, k: &Q) -> Result<Option<&Self::Target>, TryTypeError>
       where Self::Key: Borrow<Q>,
             Q: Hash + Eq + Ord + ?Sized;
}
Expand description

try_as_* access to a value as an object

Required Associated Types§

Source

type Key: ?Sized

The type for Objects

Source

type Target

The target for nested lookups

Required Methods§

Source

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

Tries 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

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.

Implementors§