pub trait EntryBinding<T> {
// Required methods
fn entry_to_object(&self, entry: &DatabaseEntry) -> Result<T>;
fn object_to_entry(
&self,
object: &T,
entry: &mut DatabaseEntry,
) -> Result<()>;
}Expand description
Converts between a DatabaseEntry and a Rust type.
This is the fundamental binding trait, analogous to EntryBinding<T>.
Implementations define how to serialize an object into a database entry
and how to deserialize it back.
Required Methods§
Sourcefn entry_to_object(&self, entry: &DatabaseEntry) -> Result<T>
fn entry_to_object(&self, entry: &DatabaseEntry) -> Result<T>
Converts a DatabaseEntry to an object.
§Errors
Returns BindError if the entry data cannot be deserialized.
Sourcefn object_to_entry(&self, object: &T, entry: &mut DatabaseEntry) -> Result<()>
fn object_to_entry(&self, object: &T, entry: &mut DatabaseEntry) -> Result<()>
Converts an object to a DatabaseEntry.
§Errors
Returns BindError if the object cannot be serialized.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".