pub trait Repr<T>:
Send
+ Sync
+ 'staticwhere
Self: Sized,{
// Required methods
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§
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.