Skip to main content

TupleBinding

Trait TupleBinding 

Source
pub trait TupleBinding<T>: EntryBinding<T> {
    // Required methods
    fn tuple_to_object(&self, input: &mut TupleInput) -> Result<T>;
    fn object_to_tuple(
        &self,
        object: &T,
        output: &mut TupleOutput,
    ) -> Result<()>;

    // Provided method
    fn entry_to_input(entry: &DatabaseEntry) -> TupleInput { ... }
}
Expand description

A binding that uses TupleInput and TupleOutput to serialize/deserialize values of type T.

Implementors define tuple_to_object and object_to_tuple to convert between a type and its tuple-encoded byte representation.

Required Methods§

Source

fn tuple_to_object(&self, input: &mut TupleInput) -> Result<T>

Converts tuple input to an object.

§Errors

Returns BindError if the data cannot be deserialized.

Source

fn object_to_tuple(&self, object: &T, output: &mut TupleOutput) -> Result<()>

Converts an object to tuple output.

§Errors

Returns BindError if the object cannot be serialized.

Provided Methods§

Source

fn entry_to_input(entry: &DatabaseEntry) -> TupleInput

Creates a TupleInput from a DatabaseEntry.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§