pub struct SegmentIdentifier {
pub height: u8,
pub idx: u64,
}
Expand description
Tuple that defines a segment of a given PMMR
Fields§
§height: u8
Height of a segment
idx: u64
Zero-based index of the segment
Implementations§
source§impl SegmentIdentifier
impl SegmentIdentifier
sourcepub fn traversal_iter(
target_mmr_size: u64,
segment_height: u8
) -> impl Iterator<Item = SegmentIdentifier>
pub fn traversal_iter( target_mmr_size: u64, segment_height: u8 ) -> impl Iterator<Item = SegmentIdentifier>
Test helper to get an iterator of SegmentIdentifiers required to read a
pmmr of size target_mmr_size
in segments of height segment_height
sourcepub fn count_segments_required(
target_mmr_size: u64,
segment_height: u8
) -> usize
pub fn count_segments_required( target_mmr_size: u64, segment_height: u8 ) -> usize
Returns number of segments required that would needed in order to read a
pmmr of size target_mmr_size
in segments of height segment_height
sourcepub fn pmmr_size(num_segments: usize, height: u8) -> u64
pub fn pmmr_size(num_segments: usize, height: u8) -> u64
Return pmmr size of number of segments of the given height
sourcepub fn segment_capacity(&self) -> u64
pub fn segment_capacity(&self) -> u64
Maximum number of leaves in a segment, given by 2**height
sourcepub fn segment_pos_range(&self, mmr_size: u64) -> (u64, u64)
pub fn segment_pos_range(&self, mmr_size: u64) -> (u64, u64)
Inclusive (full) range of MMR positions for the segment that would be produced by this Identifier
Trait Implementations§
source§impl Clone for SegmentIdentifier
impl Clone for SegmentIdentifier
source§fn clone(&self) -> SegmentIdentifier
fn clone(&self) -> SegmentIdentifier
Returns a copy 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 Debug for SegmentIdentifier
impl Debug for SegmentIdentifier
source§impl PartialEq for SegmentIdentifier
impl PartialEq for SegmentIdentifier
source§fn eq(&self, other: &SegmentIdentifier) -> bool
fn eq(&self, other: &SegmentIdentifier) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Readable for SegmentIdentifier
impl Readable for SegmentIdentifier
source§impl Writeable for SegmentIdentifier
impl Writeable for SegmentIdentifier
impl Copy for SegmentIdentifier
impl Eq for SegmentIdentifier
impl StructuralPartialEq for SegmentIdentifier
Auto Trait Implementations§
impl Freeze for SegmentIdentifier
impl RefUnwindSafe for SegmentIdentifier
impl Send for SegmentIdentifier
impl Sync for SegmentIdentifier
impl Unpin for SegmentIdentifier
impl UnwindSafe for SegmentIdentifier
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.