Trait secret_toolkit_serialization::Serde
source · pub trait Serde {
// Required methods
fn serialize<T: Serialize>(obj: &T) -> StdResult<Vec<u8>>;
fn deserialize<T: DeserializeOwned>(data: &[u8]) -> StdResult<T>;
}
Expand description
This trait represents the ability to both serialize and deserialize using a specific format.
This is useful for types that want to have a default mode of serialization, but want to allow users to override it if they want to.
It is intentionally simple at the moment to keep the implementation easy.
Required Methods§
fn serialize<T: Serialize>(obj: &T) -> StdResult<Vec<u8>>
fn deserialize<T: DeserializeOwned>(data: &[u8]) -> StdResult<T>
Object Safety§
This trait is not object safe.