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§
Object Safety§
This trait is not object safe.