Skip to main content

Pouf

Trait Pouf 

Source
pub trait Pouf: Sync {
    type RawData: Serialize + DeserializeOwned + PartialEq;

    // Required methods
    fn extension() -> &'static str;
    fn canonicalize(raw_data: &Self::RawData) -> Result<Vec<u8>>;
    fn deserialize<T>(raw_data: &Self::RawData) -> Result<T>
       where T: DeserializeOwned;
    fn serialize<T>(data: &T) -> Result<Self::RawData>
       where T: Serialize;
    fn from_slice<T>(slice: &[u8]) -> Result<T>
       where T: DeserializeOwned;
}
Expand description

The format used for data interchange, serialization, and deserialization.

Required Associated Types§

Source

type RawData: Serialize + DeserializeOwned + PartialEq

The type of data that is contained in the signed portion of metadata.

Required Methods§

Source

fn extension() -> &'static str

The data pouf’s extension.

Source

fn canonicalize(raw_data: &Self::RawData) -> Result<Vec<u8>>

A function that canonicalizes data to allow for deterministic signatures.

Source

fn deserialize<T>(raw_data: &Self::RawData) -> Result<T>

Deserialize from RawData.

Source

fn serialize<T>(data: &T) -> Result<Self::RawData>
where T: Serialize,

Serialize into RawData.

Source

fn from_slice<T>(slice: &[u8]) -> Result<T>

Read a struct from a stream.

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.

Implementors§