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
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 duplicate 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> Freeze for CachedValue<H>where
H: Freeze,
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