Trait async_session_types::Repr
source · [−]pub trait Repr<T>: Send + Sync + 'static where
Self: Sized, {
fn from(v: T) -> Self;
fn try_into(self) -> Result<T, Self>;
fn can_into(&self) -> bool;
}
Expand description
Define for the wire representation, so that the raw messages can be lifted into it, and later the representation can be cast back into the expected types.
Similar to From<T> for R
plus TryInto<T> for R
.
Unfortunately the built-in implementations lead to conflicts for DynMessage
.
use async_session_types::*;
let repr: DynMessage = Repr::from(123u8);
let msg: u8 = Repr::try_into(repr).unwrap();
Required methods
Try to convert the representation back into one of the raw message types.
Implementors
impl<T: 'static + Send + Sync> Repr<T> for DynMessage
We can turn anything into a DynMessage
.