[][src]Trait catwalk::Serializer

pub trait Serializer {
    pub fn to_bytes<M, R>(&self, model: &M) -> Result<R>
    where
        M: Model,
        R: AsRef<[u8]>
;
pub fn from_bytes<M, R>(&self, bytes: R) -> Result<StoredModel<M>>
    where
        M: Model,
        R: AsRef<[u8]>
; }

(De)serializes Models in the form of a slice of u8 bytes. When a Model is serialized, it is serialized along with its version, via a StoredModel struct.

Both the model itself and its version must be serialized and deserialized.

Required methods

pub fn to_bytes<M, R>(&self, model: &M) -> Result<R> where
    M: Model,
    R: AsRef<[u8]>, 
[src]

Serializes a Model and its version into bytes.

NOTE: The model's version must be serialized as part of the process.

pub fn from_bytes<M, R>(&self, bytes: R) -> Result<StoredModel<M>> where
    M: Model,
    R: AsRef<[u8]>, 
[src]

Deserializes a Model and its version from bytes.

NOTE: The model's version must be deserialized as part of the process.

Loading content...

Implementors

Loading content...