pub trait Record:
Serialize
+ DeserializeOwned
+ Sized {
type Key: Into<Vec<u8>>;
// Required method
fn key(&self) -> Self::Key;
// Provided methods
fn db_name() -> &'static str { ... }
fn to_binary(&self) -> Result<Vec<u8>, Error> { ... }
fn from_binary(bytes: &[u8]) -> Result<Self, Error> { ... }
}Expand description
When a type conforms to this trait it allows it to be stored and retrieved from the database
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn from_binary(bytes: &[u8]) -> Result<Self, Error>
fn from_binary(bytes: &[u8]) -> Result<Self, Error>
Deserializes a record from binary
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.