pub struct WeakBlock<T: BlockMetadata> { /* private fields */ }Expand description
Non-owning reference to a registered block.
Created via ImmutableBlock::downgrade. Cheap to clone. Calling
upgrade tries Weak::upgrade first (fast path) and
falls back to resurrecting the block from the store’s inactive pool
via the registry (slow path).
Implementations§
Source§impl<T: BlockMetadata + Sync> WeakBlock<T>
impl<T: BlockMetadata + Sync> WeakBlock<T>
Sourcepub fn upgrade(&self) -> Option<ImmutableBlock<T>>
pub fn upgrade(&self) -> Option<ImmutableBlock<T>>
Attempt to upgrade this weak reference to a strong ImmutableBlock.
Sourcepub fn sequence_hash(&self) -> SequenceHash
pub fn sequence_hash(&self) -> SequenceHash
Returns the SequenceHash for the block this weak reference
points to.
Trait Implementations§
Source§impl<T: BlockMetadata> Clone for WeakBlock<T>
impl<T: BlockMetadata> Clone for WeakBlock<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for WeakBlock<T>
impl<T> !UnwindSafe for WeakBlock<T>
impl<T> Freeze for WeakBlock<T>
impl<T> Send for WeakBlock<T>
impl<T> Sync for WeakBlock<T>
impl<T> Unpin for WeakBlock<T>
impl<T> UnsafeUnpin for WeakBlock<T>
Blanket Implementations§
impl<T> BlockMetadata for T
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