Trait RlpBincode
pub trait RlpBincode: Encodable + Decodable { }
Expand description
A helper trait for using RLP-encoding for providing bincode-compatible serialization.
By implementing this trait, SerdeBincodeCompat
will be automatically implemented for the
type and RLP encoding will be used for serialization and deserialization for bincode
compatibility.
§Example
#[derive(RlpEncodable, RlpDecodable)]
struct MyCustomType {
value: u64,
data: Vec<u8>,
}
// Simply implement the marker trait
impl RlpBincode for MyCustomType {}
// Now MyCustomType can be used with bincode through RLP encoding
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.