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§
Sourcefn by_id(&self, id: &Identifier) -> Option<&Value>
fn by_id(&self, id: &Identifier) -> Option<&Value>
Find named value by identifier.
Provided Methods§
Sourcefn by_str<'a, T>(&'a self, id: &str) -> Result<T, ValueError>
fn by_str<'a, T>(&'a self, id: &str) -> Result<T, ValueError>
Helper function to fetch an argument by string.
Sourcefn get_value(&self, id: &str) -> Result<&Value, ValueError>
fn get_value(&self, id: &str) -> Result<&Value, ValueError>
Fetch an argument value by name as &str
.
Panics if id
cannot be found.`
Sourcefn contains_id(&self, id: &Identifier) -> bool
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.