pub struct TokenBlock { /* private fields */ }Expand description
Represents a completed, immutable block of tokens with associated hashes.
Contains exactly block_size tokens and includes the SaltHash, BlockHash,
SequenceHash, PositionalSequenceHash, PositionalLineageHash, and optionally the parent’s SequenceHash.
Implementations§
Source§impl TokenBlock
impl TokenBlock
Sourcepub fn next_block(&self) -> PartialTokenBlock
pub fn next_block(&self) -> PartialTokenBlock
Creates a new PartialTokenBlock representing the block immediately following this one.
The new partial block will have the correct parent_sequence_hash and position set.
Sourcepub fn block_hash(&self) -> BlockHash
pub fn block_hash(&self) -> BlockHash
Returns the hash of only the tokens within this block.
Sourcepub fn sequence_hash(&self) -> SequenceHash
pub fn sequence_hash(&self) -> SequenceHash
Returns the sequence-aware hash for this block.
Sourcepub fn parent_sequence_hash(&self) -> Option<SequenceHash>
pub fn parent_sequence_hash(&self) -> Option<SequenceHash>
Returns the sequence hash of the preceding block, if any.
Sourcepub fn block_size(&self) -> usize
pub fn block_size(&self) -> usize
Returns the number of tokens in the block.
Sourcepub fn positional_sequence_hash(&self) -> PositionalSequenceHash
pub fn positional_sequence_hash(&self) -> PositionalSequenceHash
Returns the positional sequence hash for this block.
Sourcepub fn positional_lineage_hash(&self) -> PositionalLineageHash
pub fn positional_lineage_hash(&self) -> PositionalLineageHash
Returns the positional lineage hash for this block.
Trait Implementations§
Source§impl Clone for TokenBlock
impl Clone for TokenBlock
Source§fn clone(&self) -> TokenBlock
fn clone(&self) -> TokenBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenBlock
impl Debug for TokenBlock
Source§impl Default for TokenBlock
impl Default for TokenBlock
Source§fn default() -> TokenBlock
fn default() -> TokenBlock
Returns the “default value” for a type. Read more
Source§impl PartialEq for TokenBlock
impl PartialEq for TokenBlock
impl StructuralPartialEq for TokenBlock
Auto Trait Implementations§
impl Freeze for TokenBlock
impl RefUnwindSafe for TokenBlock
impl Send for TokenBlock
impl Sync for TokenBlock
impl Unpin for TokenBlock
impl UnsafeUnpin for TokenBlock
impl UnwindSafe for TokenBlock
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