pub struct Index { /* private fields */ }Expand description
An index of block ranges for quick lookups
Implementations§
Source§impl Index
impl Index
Sourcepub fn from_block_headers(block_headers: &[BlockHeader]) -> Self
pub fn from_block_headers(block_headers: &[BlockHeader]) -> Self
Builds the index from a list of block headers
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Builds the index from a byte slice
Sourcepub fn num_records(&self) -> usize
pub fn num_records(&self) -> usize
Returns the number of records in the index
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Returns the number of blocks in the index
pub fn iter_blocks(&self) -> BlockIter<'_>
pub fn average_block_size(&self) -> f64
pub fn pprint(&self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more