pub trait CustomSerialize: Sized {
// Required methods
fn to_custom_bytes(&self) -> Result<Vec<u8>, ViewError>;
fn from_custom_bytes(short_key: &[u8]) -> Result<Self, ViewError>;
}
Expand description
Sometimes we need a serialization that is different from the usual one and
for example preserves order.
{to/from}_custom_bytes
has to be coherent with the Borrow
trait.
Required Methods§
Sourcefn from_custom_bytes(short_key: &[u8]) -> Result<Self, ViewError>
fn from_custom_bytes(short_key: &[u8]) -> Result<Self, ViewError>
Deserialize the vector
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.