Serializer

Trait Serializer 

Source
pub trait Serializer {
    type Value;

    // Required methods
    fn is_utf8(&self) -> bool;
    fn extension(&self) -> &str;
    fn from_data(&self, data: &[u8]) -> Option<Self::Value>;
    fn to_data(&self, value: &Self::Value) -> Vec<u8> ;
}
Expand description

A Serializer is used to encode and decode values into bytes.

One possible implementation would be to use serde to implement both required functions. But we also want to be able to fuzz-test types that are not serializable with serde, which is why this Serializer trait exists.

Required Associated Types§

Required Methods§

Source

fn is_utf8(&self) -> bool

Source

fn extension(&self) -> &str

Source

fn from_data(&self, data: &[u8]) -> Option<Self::Value>

Source

fn to_data(&self, value: &Self::Value) -> Vec<u8>

Implementors§