Enum trie_db::CachedValue
source · 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.
The value exists in the trie.
Implementations§
source§impl<H: Copy> CachedValue<H>
impl<H: Copy> CachedValue<H>
sourcepub fn data(&self) -> Option<Option<Bytes>>
pub fn data(&self) -> Option<Option<Bytes>>
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.
Trait Implementations§
source§impl<H: Clone> Clone for CachedValue<H>
impl<H: Clone> Clone for CachedValue<H>
source§fn clone(&self) -> CachedValue<H>
fn clone(&self) -> CachedValue<H>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more