Trait SerdeBincodeCompat

Source
pub trait SerdeBincodeCompat: Sized + 'static {
    type BincodeRepr<'a>: Debug + Serialize + DeserializeOwned;

    // Required methods
    fn as_repr(&self) -> Self::BincodeRepr<'_>;
    fn from_repr(repr: Self::BincodeRepr<'_>) -> Self;
}
Available on crate feature serde-bincode-compat only.
Expand description

Trait for types that can be serialized and deserialized using bincode.

The recommended way to add bincode compatible serialization is via the serde_with crate and the serde_as macro that. See for reference header.

Required Associated Types§

Source

type BincodeRepr<'a>: Debug + Serialize + DeserializeOwned

Serde representation of the type for bincode serialization.

This type defines the bincode compatible serde format for the type.

Required Methods§

Source

fn as_repr(&self) -> Self::BincodeRepr<'_>

Convert this type into its bincode representation

Source

fn from_repr(repr: Self::BincodeRepr<'_>) -> Self

Convert from the bincode representation

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.

Implementations on Foreign Types§

Source§

impl<T: SerdeBincodeCompat, H: SerdeBincodeCompat> SerdeBincodeCompat for Block<T, H>

Source§

type BincodeRepr<'a> = Block<'a, T, H>

Source§

fn as_repr(&self) -> Self::BincodeRepr<'_>

Source§

fn from_repr(repr: Self::BincodeRepr<'_>) -> Self

Source§

impl<T: SerdeBincodeCompat, H: SerdeBincodeCompat> SerdeBincodeCompat for BlockBody<T, H>

Source§

type BincodeRepr<'a> = BlockBody<'a, T, H>

Source§

fn as_repr(&self) -> Self::BincodeRepr<'_>

Source§

fn from_repr(repr: Self::BincodeRepr<'_>) -> Self

Implementors§

Source§

impl SerdeBincodeCompat for Header

Source§

type BincodeRepr<'a> = Header<'a>

Source§

impl<H: Sealable + SerdeBincodeCompat> SerdeBincodeCompat for SealedHeader<H>

Source§

impl<T: Block<Header: SerdeBincodeCompat, Body: SerdeBincodeCompat> + 'static> SerdeBincodeCompat for RecoveredBlock<T>

Source§

impl<T: Block<Header: SerdeBincodeCompat, Body: SerdeBincodeCompat> + 'static> SerdeBincodeCompat for SealedBlock<T>

impl SerdeBincodeCompat for Receipt

impl SerdeBincodeCompat for TransactionSigned

impl<T: SerdeBincodeCompat + Debug> SerdeBincodeCompat for ExecutionOutcome<T>

impl SerdeBincodeCompat for OpReceipt

impl SerdeBincodeCompat for OpTransactionSigned