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 moresource§impl<H: Debug> Debug for CachedValue<H>
impl<H: Debug> Debug for CachedValue<H>
source§impl<H> From<(Bytes, H)> for CachedValue<H>
impl<H> From<(Bytes, H)> for CachedValue<H>
source§impl<H> From<H> for CachedValue<H>
impl<H> From<H> for CachedValue<H>
Auto Trait Implementations§
impl<H> RefUnwindSafe for CachedValue<H>where H: RefUnwindSafe,
impl<H> Send for CachedValue<H>where H: Send,
impl<H> Sync for CachedValue<H>where H: Sync,
impl<H> Unpin for CachedValue<H>where H: Unpin,
impl<H> UnwindSafe for CachedValue<H>where H: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more