Trait relay_event_schema::protocol::AsPair

source ·
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§

source

fn from_pair(pair: (Annotated<Self::Key>, Annotated<Self::Value>)) -> Self

Constructs this value from a raw tuple.

source

fn into_pair(self) -> (Annotated<Self::Key>, Annotated<Self::Value>)

Converts this pair into a raw tuple.

source

fn as_pair(&self) -> (&Annotated<Self::Key>, &Annotated<Self::Value>)

Extracts a key and value pair from the object.

source

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§

source

fn key(&self) -> Option<&str>

Returns a reference to the string representation of the key.

source

fn value(&self) -> Option<&Self::Value>

Returns a reference to the value.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<K, V> AsPair for (Annotated<K>, Annotated<V>)
where K: AsRef<str>, V: ProcessValue,

source§

type Key = K

source§

type Value = V

source§

fn from_pair(pair: (Annotated<Self::Key>, Annotated<Self::Value>)) -> Self

source§

fn into_pair(self) -> (Annotated<Self::Key>, Annotated<Self::Value>)

source§

fn as_pair(&self) -> (&Annotated<Self::Key>, &Annotated<Self::Value>)

source§

fn as_pair_mut( &mut self, ) -> (&mut Annotated<Self::Key>, &mut Annotated<Self::Value>)

Implementors§