pub trait AsPair {
type Key: AsRef<str>;
type Value: ProcessValue;
// Required methods
fn from_pair(pair: (Annotated<Self::Key>, Annotated<Self::Value>)) -> Self;
fn into_pair(self) -> (Annotated<Self::Key>, Annotated<Self::Value>);
fn as_pair(&self) -> (&Annotated<Self::Key>, &Annotated<Self::Value>);
fn as_pair_mut(
&mut self,
) -> (&mut Annotated<Self::Key>, &mut Annotated<Self::Value>);
// Provided methods
fn key(&self) -> Option<&str> { ... }
fn value(&self) -> Option<&Self::Value> { ... }
}
Expand description
A trait to abstract over pairs.
Required Associated Types§
Required Methods§
Sourcefn from_pair(pair: (Annotated<Self::Key>, Annotated<Self::Value>)) -> Self
fn from_pair(pair: (Annotated<Self::Key>, Annotated<Self::Value>)) -> Self
Constructs this value from a raw tuple.
Sourcefn into_pair(self) -> (Annotated<Self::Key>, Annotated<Self::Value>)
fn into_pair(self) -> (Annotated<Self::Key>, Annotated<Self::Value>)
Converts this pair into a raw tuple.
Sourcefn as_pair(&self) -> (&Annotated<Self::Key>, &Annotated<Self::Value>)
fn as_pair(&self) -> (&Annotated<Self::Key>, &Annotated<Self::Value>)
Extracts a key and value pair from the object.
Sourcefn as_pair_mut(
&mut self,
) -> (&mut Annotated<Self::Key>, &mut Annotated<Self::Value>)
fn as_pair_mut( &mut self, ) -> (&mut Annotated<Self::Key>, &mut Annotated<Self::Value>)
Extracts the mutable key and value pair from the object.
Provided Methods§
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.