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

Convert a raw type to the common representation.

Try to convert the representation back into one of the raw message types.

Check whether the representation can be turned into this raw type, without consuming.

Implementors

We can turn anything into a DynMessage.