reth_db::table

Trait Compress

pub trait Compress:
    Sized
    + Send
    + Sync
    + Debug {
    type Compressed: BufMut + AsRef<[u8]> + AsMut<[u8]> + Into<Vec<u8>> + Default + Send + Sync + Debug;

    // Required method
    fn compress_to_buf<B>(self, buf: &mut B)
       where B: BufMut + AsMut<[u8]>;

    // Provided methods
    fn uncompressable_ref(&self) -> Option<&[u8]> { ... }
    fn compress(self) -> Self::Compressed { ... }
}
Expand description

Trait that will transform the data to be saved in the DB in a (ideally) compressed format

Required Associated Types§

type Compressed: BufMut + AsRef<[u8]> + AsMut<[u8]> + Into<Vec<u8>> + Default + Send + Sync + Debug

Compressed type.

Required Methods§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

Compresses data to a given buffer.

Provided Methods§

fn uncompressable_ref(&self) -> Option<&[u8]>

If the type cannot be compressed, return its inner reference as Some(self.as_ref())

fn compress(self) -> Self::Compressed

Compresses 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 Compress for Account

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for Address

§

type Compressed = Vec<u8>

§

fn uncompressable_ref(&self) -> Option<&[u8]>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for BranchNodeCompact

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for Bytecode

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for Bytes

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for FixedBytes<32>

§

type Compressed = Vec<u8>

§

fn uncompressable_ref(&self) -> Option<&[u8]>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for GenesisAccount

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for Header

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for IntegerList

§

type Compressed = Vec<u8>

§

fn compress(self) -> <IntegerList as Compress>::Compressed

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for Log

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for PruneCheckpoint

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for Receipt

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for StageCheckpoint

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for StorageEntry

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for StorageTrieEntry

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for StoredNibbles

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for StoredNibblesSubKey

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for TransactionSignedNoHash

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

§

impl Compress for TxType

§

type Compressed = Vec<u8>

§

fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>,

Implementors§