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
The value exists in the trie.
Implementations
sourceimpl<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
sourceimpl<H: Clone> Clone for CachedValue<H>
impl<H: Clone> Clone for CachedValue<H>
sourcefn clone(&self) -> CachedValue<H>
fn clone(&self) -> CachedValue<H>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<H: Debug> Debug for CachedValue<H>
impl<H: Debug> Debug for CachedValue<H>
sourceimpl<H> From<(Bytes, H)> for CachedValue<H>
impl<H> From<(Bytes, H)> for CachedValue<H>
sourceimpl<H> From<H> for CachedValue<H>
impl<H> From<H> for CachedValue<H>
sourceimpl<H> From<Option<(Bytes, H)>> for CachedValue<H>
impl<H> From<Option<(Bytes, 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more