external_buffered_stream/serde.rs
1#[cfg(feature = "bincode")]
2pub mod bincode;
3
4use crate::Error;
5
6/// Convert object into data that can saved in external buffer and vice versa
7/// This trait is not necessary if your external use a staroge like sqlite, in
8/// which case data store and retrieve without serde.
9pub trait ExternalBufferSerde: Sized {
10 fn into_external_buffer(self) -> Result<Vec<u8>, Error>;
11
12 fn from_external_buffer(value: &[u8]) -> Result<Self, Error>;
13}