Trait SerializerType

Source
pub trait SerializerType {
    type S;

    // Required methods
    fn new(serialized: Vec<u8>) -> Self
       where Self: Sized;
    fn as_slice(&self) -> &[u8] ;
    fn into_vec(self) -> Vec<u8> ;
    fn serialize(v: &Self::S) -> Result<Self, SerdeVaultError>
       where Self: Sized,
             Self::S: Serialize;
    fn deserialize<'de>(&'de self) -> Result<Self::S, SerdeVaultError>
       where Self::S: Deserialize<'de>;
}
Expand description

Serialization abstract with type to serialize.

Serializer implementations must implement this trait.

Required Associated Types§

Source

type S

Type to serialize

Required Methods§

Source

fn new(serialized: Vec<u8>) -> Self
where Self: Sized,

Source

fn as_slice(&self) -> &[u8]

Ref to serialized.

Source

fn into_vec(self) -> Vec<u8>

Into serialized.

Source

fn serialize(v: &Self::S) -> Result<Self, SerdeVaultError>
where Self: Sized, Self::S: Serialize,

§Failures
  • SerdeVaultError when failed to serialize message.
Source

fn deserialize<'de>(&'de self) -> Result<Self::S, SerdeVaultError>
where Self::S: Deserialize<'de>,

§Failures
  • SerdeVaultError when failed to deserialize decrypted message.

Implementors§