reth_db::table

Trait Encode

pub trait Encode:
    Sized
    + Send
    + Sync
    + Debug {
    type Encoded: AsRef<[u8]> + Into<Vec<u8>> + Send + Sync + Ord + Debug;

    // Required method
    fn encode(self) -> Self::Encoded;
}
Expand description

Trait that will transform the data to be saved in the DB.

Required Associated Types§

type Encoded: AsRef<[u8]> + Into<Vec<u8>> + Send + Sync + Ord + Debug

Encoded type.

Required Methods§

fn encode(self) -> Self::Encoded

Encodes data going into the database.

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.

Implementations on Foreign Types§

§

impl Encode for u8

§

type Encoded = [u8; 1]

§

fn encode(self) -> <u8 as Encode>::Encoded

§

impl Encode for u16

§

type Encoded = [u8; 2]

§

fn encode(self) -> <u16 as Encode>::Encoded

§

impl Encode for u32

§

type Encoded = [u8; 4]

§

fn encode(self) -> <u32 as Encode>::Encoded

§

impl Encode for u64

§

type Encoded = [u8; 8]

§

fn encode(self) -> <u64 as Encode>::Encoded

§

impl Encode for String

§

type Encoded = Vec<u8>

§

fn encode(self) -> <String as Encode>::Encoded

§

impl Encode for Vec<u8>

§

type Encoded = Vec<u8>

§

fn encode(self) -> <Vec<u8> as Encode>::Encoded

§

impl Encode for Address

§

type Encoded = [u8; 20]

§

fn encode(self) -> <Address as Encode>::Encoded

§

impl Encode for FixedBytes<32>

§

type Encoded = [u8; 32]

§

fn encode(self) -> <FixedBytes<32> as Encode>::Encoded

§

impl Encode for PruneSegment

§

type Encoded = [u8; 1]

§

fn encode(self) -> <PruneSegment as Encode>::Encoded

§

impl Encode for StoredNibbles

§

type Encoded = Vec<u8>

§

fn encode(self) -> <StoredNibbles as Encode>::Encoded

§

impl Encode for StoredNibblesSubKey

§

type Encoded = Vec<u8>

§

fn encode(self) -> <StoredNibblesSubKey as Encode>::Encoded

Implementors§