Skip to main content

FromDatabaseBytes

Trait FromDatabaseBytes 

Source
pub trait FromDatabaseBytes {
    // Required method
    fn from_key_bytes(bytes: &[u8]) -> Self
       where Self: Sized;

    // Provided method
    fn from_value_bytes(bytes: &[u8]) -> Self
       where Self: Sized { ... }
}

Required Methods§

Source

fn from_key_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Reads the value from the database key bytes. In the default implementation, this will also be used for the value bytes.

Provided Methods§

Source

fn from_value_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Reads the value from the database bytes (in value encoding). This is only necessary if the value needs to be sorted differently in a dup table. DUP values use a lexicographic sort order.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl FromDatabaseBytes for ()

Source§

fn from_key_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

impl FromDatabaseBytes for String

Source§

fn from_key_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

impl FromDatabaseBytes for Vec<u8>

Source§

fn from_key_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

impl FromDatabaseBytes for u16

Source§

fn from_key_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

fn from_value_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

impl FromDatabaseBytes for u32

Source§

fn from_key_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

fn from_value_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

impl FromDatabaseBytes for u64

Source§

fn from_key_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Source§

fn from_value_bytes(bytes: &[u8]) -> Self
where Self: Sized,

Implementors§