pub enum CachedValue<H> {
    NonExisting,
    ExistingHash(H),
    Existing {
        hash: H,
        data: BytesWeak,
    },
}
Expand description

A value as cached by the TrieCache.

Variants

NonExisting

The value doesn’t exist in the trie.

ExistingHash(H)

We cached the hash, because we did not yet accessed the data.

Existing

Fields

hash: H

The hash of the value.

data: BytesWeak

The actual data of the value stored as BytesWeak.

The original data Bytes is stored in the trie node that is also cached by the TrieCache. If this node is dropped, this data will also not be “upgradeable” anymore.

The value exists in the trie.

Implementations

Returns the data of the value.

If a value doesn’t exist in the trie or only the value hash is cached, this function returns None. If the reference to the data couldn’t be upgraded (see [Bytes::upgrade]), this function returns Some(None), aka the data needs to be fetched again from the trie.

Returns the hash of the value.

Returns only None when the value doesn’t exist.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts to this type from the input type.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.