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§
Sourcetype BincodeRepr<'a>: Debug + Serialize + DeserializeOwned
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§
Sourcefn as_repr(&self) -> Self::BincodeRepr<'_>
fn as_repr(&self) -> Self::BincodeRepr<'_>
Convert this type into its bincode representation
Sourcefn from_repr(repr: Self::BincodeRepr<'_>) -> Self
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 SerdeBincodeCompat for EthereumTxEnvelope<TxEip4844>
impl SerdeBincodeCompat for EthereumTxEnvelope<TxEip4844>
type BincodeRepr<'a> = EthereumTxEnvelope<'a>
fn as_repr(&self) -> Self::BincodeRepr<'_>
fn from_repr(repr: Self::BincodeRepr<'_>) -> Self
Source§impl SerdeBincodeCompat for OpTxEnvelope
Available on crate feature op only.
impl SerdeBincodeCompat for OpTxEnvelope
Available on crate feature
op only.