ValueAccess

Trait ValueAccess 

Source
pub trait ValueAccess {
    // Required methods
    fn by_id(&self, id: &Identifier) -> Option<&Value>;
    fn by_ty(&self, ty: &Type) -> Option<&Value>;

    // Provided methods
    fn by_str<'a, T>(&'a self, id: &str) -> Result<T, ValueError>
       where T: TryFrom<&'a Value>,
             T::Error: Debug { ... }
    fn get<'a, T>(&'a self, id: &str) -> T
       where T: TryFrom<&'a Value>,
             T::Error: Debug { ... }
    fn get_value(&self, id: &str) -> Result<&Value, ValueError> { ... }
    fn contains_id(&self, id: &Identifier) -> bool { ... }
}
Expand description

Trait for Value Lists

Required Methods§

Source

fn by_id(&self, id: &Identifier) -> Option<&Value>

Find named value by identifier.

Source

fn by_ty(&self, ty: &Type) -> Option<&Value>

Find unnamed value by type.

Provided Methods§

Source

fn by_str<'a, T>(&'a self, id: &str) -> Result<T, ValueError>
where T: TryFrom<&'a Value>, T::Error: Debug,

Helper function to fetch an argument by string.

Source

fn get<'a, T>(&'a self, id: &str) -> T
where T: TryFrom<&'a Value>, T::Error: Debug,

Fetch an argument value by name as &str.

Source

fn get_value(&self, id: &str) -> Result<&Value, ValueError>

Fetch an argument value by name as &str.

Panics if id cannot be found.`

Source

fn contains_id(&self, id: &Identifier) -> bool

Return true, if tuple contains a value with that name

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§