Skip to main content

PartCodec

Trait PartCodec 

Source
pub trait PartCodec: Sized
where for<'a> Self::Repr: Serialize + DeserializeOwned + Named + TryFrom<&'a Self, Error = Error>, Self: TryFrom<Self::Repr, Error = Error>,
{ type Repr; // Provided methods fn to_repr(&self) -> Result<Self::Repr> { ... } fn from_repr(repr: Self::Repr) -> Result<Self> { ... } fn to_part(&self) -> Result<Part> { ... } fn from_part(part: Part) -> Result<Self> { ... } }
Expand description

Converts a framework type to and from a typed multipart part.

Required Associated Types§

Source

type Repr

The bincode representation stored in typed parts.

Provided Methods§

Source

fn to_repr(&self) -> Result<Self::Repr>

Convert this value to its typed part representation.

Source

fn from_repr(repr: Self::Repr) -> Result<Self>

Rebuild this value from its typed part representation.

Source

fn to_part(&self) -> Result<Part>

Convert this value to a typed part.

Source

fn from_part(part: Part) -> Result<Self>

Rebuild this value from a typed part.

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.

Implementors§