Compress

Trait Compress 

Source
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 { ... }
}
Available on crate feature provider only.
Expand description

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

Required Associated Types§

Source

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

Compressed type.

Required Methods§

Source

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

Compresses data to a given buffer.

Provided Methods§

Source

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

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

Source

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§

Source§

impl Compress for EthereumTxEnvelope<TxEip4844>

Source§

type Compressed = Vec<u8>

Source§

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

Source§

impl Compress for GenesisAccount

Source§

type Compressed = Vec<u8>

Source§

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

Source§

impl Compress for OpReceipt

Source§

type Compressed = Vec<u8>

Source§

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

Source§

impl Compress for OpTxEnvelope

Source§

type Compressed = Vec<u8>

Source§

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

Source§

impl Compress for PruneCheckpoint

Source§

type Compressed = Vec<u8>

Source§

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

Source§

impl Compress for StageCheckpoint

Source§

type Compressed = Vec<u8>

Source§

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

Implementors§

Source§

impl Compress for TxType

Source§

impl Compress for Address

Source§

impl Compress for Bytes

Source§

impl Compress for FixedBytes<32>

Source§

impl Compress for Account

Source§

impl Compress for Bytecode

Source§

impl Compress for Header

Source§

impl Compress for Log

Source§

impl Compress for StorageEntry

Source§

impl Compress for BranchNodeCompact

Source§

impl Compress for StorageTrieEntry

Source§

impl Compress for StoredNibbles

Source§

impl Compress for StoredNibblesSubKey

Source§

impl Compress for TrieChangeSetsEntry

Source§

impl Compress for AccountBeforeTx

Source§

impl Compress for CompactU256

Source§

impl Compress for IntegerList

Source§

impl Compress for StaticFileBlockWithdrawals

Source§

impl Compress for StoredBlockBodyIndices

Source§

impl Compress for StoredBlockWithdrawals

Source§

impl Compress for ClientVersion

Source§

impl<H> Compress for StoredBlockOmmers<H>
where H: Debug + Send + Sync + Compact,

Source§

impl<T> Compress for EthereumReceipt<T>
where T: Debug + Send + Sync + Compact,

Source§

impl<T> Compress for T
where T: ScaleValue + Encode + Sync + Send + Debug,

Source§

impl<V> Compress for RawValue<V>
where V: Value,