Trait linera_sdk::views::CustomSerialize
source · 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
Object Safety§
This trait is not object safe.