pub trait ConcreteVariantObject {
type Value: VariantValue<VariantObject = Self>;
// Required methods
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
fn get(&self, key: &str) -> Option<&Self::Value>;
fn get_key_value(&self, key: &str) -> Option<(&String, &Self::Value)>;
fn iter(&self) -> impl Iterator<Item = (&String, &Self::Value)>;
fn values(&self) -> impl Iterator<Item = &Self::Value>;
}Expand description
A trait for the concrete variant object type associated with a variant value.
Required Associated Types§
Sourcetype Value: VariantValue<VariantObject = Self>
type Value: VariantValue<VariantObject = Self>
The type of the value in the object.
Required Methods§
Sourcefn get(&self, key: &str) -> Option<&Self::Value>
fn get(&self, key: &str) -> Option<&Self::Value>
Get the value for the given key; None if the key is not present.
Sourcefn get_key_value(&self, key: &str) -> Option<(&String, &Self::Value)>
fn get_key_value(&self, key: &str) -> Option<(&String, &Self::Value)>
Get the key-value pair for the given key; None if the key is not present.
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.
Implementations on Foreign Types§
Source§impl ConcreteVariantObject for Map<String, Value>
Available on crate feature json only.
impl ConcreteVariantObject for Map<String, Value>
Available on crate feature
json only.type Value = Value
fn is_empty(&self) -> bool
fn len(&self) -> usize
fn get(&self, key: &str) -> Option<&Self::Value>
fn get_key_value(&self, key: &str) -> Option<(&String, &Self::Value)>
fn iter(&self) -> impl Iterator<Item = (&String, &Self::Value)>
fn values(&self) -> impl Iterator<Item = &Self::Value>
Source§impl ConcreteVariantObject for Table
Available on crate feature toml only.
impl ConcreteVariantObject for Table
Available on crate feature
toml only.