Trait key_store::traits::KeyStoreValue[][src]

pub trait KeyStoreValue<Serialization = Vec<u8>> {
    type Error: Debug + Clone + PartialEq + Into<String>;
    type SerializedValue: Into<Serialization>;
    fn serialize(&self) -> Result<Self::SerializedValue, Self::Error>;
fn deserialize(raw: &mut [u8]) -> Result<Self, Self::Error>
    where
        Self: Sized
; }

Any value that is stored in the key store must implement this trait. In most cases these are the raw bytes of the object.

The generic Serialization defaults to Vec<u8> but can be defined differently. The serialize return type SerializedValue must implement Into<Serialization>.

Associated Types

type Error: Debug + Clone + PartialEq + Into<String>[src]

The error type returned by the KeyStoreValue.

type SerializedValue: Into<Serialization>[src]

The type of a serialized key store value.

Loading content...

Required methods

fn serialize(&self) -> Result<Self::SerializedValue, Self::Error>[src]

Serialize the value and return it as SerializedValue.

Returns an Error if the serialization fails.

fn deserialize(raw: &mut [u8]) -> Result<Self, Self::Error> where
    Self: Sized
[src]

Deserialize the byte slice and return the object.

Returns an Error if the deserialization fails.

Loading content...

Implementors

impl KeyStoreValue<Vec<u8, Global>> for Status[src]

type Error = StatusError

type SerializedValue = Vec<u8>

Loading content...