[][src]Trait nostalgia::Record

pub trait Record: Serialize + DeserializeOwned + Sized {
    type Key: Into<Vec<u8>>;
    pub fn key(&self) -> Self::Key;

    pub fn db_name() -> &'static str { ... }
pub fn to_binary(&self) -> Result<Vec<u8>, Error> { ... }
pub fn from_binary(bytes: &[u8]) -> Result<Self, Error> { ... } }

When a type conforms to this trait it allows it to be stored and retrieved from the database

Associated Types

Loading content...

Required methods

pub fn key(&self) -> Self::Key[src]

Used to determine the key to use to associate with the object in the database

Loading content...

Provided methods

pub fn db_name() -> &'static str[src]

The database name to save a record in. Defaults to 'default'

pub fn to_binary(&self) -> Result<Vec<u8>, Error>[src]

Serializes the record to binary

pub fn from_binary(bytes: &[u8]) -> Result<Self, Error>[src]

Deserializes a record from binary

Loading content...

Implementors

Loading content...