pub struct CompleteBlock<T: BlockMetadata> { /* private fields */ }Expand description
RAII guard for a block in the Staged state.
Wraps an internal Block<T, Staged> – a block that carries a
SequenceHash and is ready for registration.
§Obtaining a CompleteBlock
MutableBlock::stage– from a pre-computedSequenceHash.MutableBlock::complete– by extracting the hash from aTokenBlock.
§State transitions
- Pass to
BlockManager::register_blockto move the block into the Registered state and receive anImmutableBlock. - Call
resetto undo the staging and get aMutableBlockback (metrics areNoneon this path).
§Drop behaviour
If the CompleteBlock is dropped without being consumed, the underlying
block is reset to the Reset state and returned to the reset pool.
Implementations§
Source§impl<T: BlockMetadata> CompleteBlock<T>
impl<T: BlockMetadata> CompleteBlock<T>
Sourcepub fn sequence_hash(&self) -> SequenceHash
pub fn sequence_hash(&self) -> SequenceHash
Returns the SequenceHash that was assigned
during staging.
Sourcepub fn reset(self) -> MutableBlock<T>
pub fn reset(self) -> MutableBlock<T>
Undoes the staging transition, returning a MutableBlock in the
Reset state.
The returned MutableBlock does not carry metrics (they are set
to None) because this is an undo/rollback path rather than a fresh
allocation.
Trait Implementations§
Source§impl<T: BlockMetadata> Drop for CompleteBlock<T>
impl<T: BlockMetadata> Drop for CompleteBlock<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for CompleteBlock<T>
impl<T> !UnwindSafe for CompleteBlock<T>
impl<T> Freeze for CompleteBlock<T>
impl<T> Send for CompleteBlock<T>
impl<T> Sync for CompleteBlock<T>
impl<T> Unpin for CompleteBlock<T>where
T: Unpin,
impl<T> UnsafeUnpin for CompleteBlock<T>
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