pub struct Chain<'a> { /* private fields */ }
Expand description
Represents a chain instance for querying and traversal.
Implementations§
Source§impl<'a> Chain<'a>
impl<'a> Chain<'a>
Sourcepub fn tip(&self) -> BlockTreeEntry<'a>
pub fn tip(&self) -> BlockTreeEntry<'a>
Returns the tip (highest block) of the active chain.
Sourcepub fn genesis(&self) -> BlockTreeEntry<'a>
pub fn genesis(&self) -> BlockTreeEntry<'a>
Returns the genesis block (height 0) of the chain.
Sourcepub fn at_height(&self, height: usize) -> Option<BlockTreeEntry<'a>>
pub fn at_height(&self, height: usize) -> Option<BlockTreeEntry<'a>>
Returns the block at the specified height, if it exists.
Sourcepub fn contains(&self, entry: &BlockTreeEntry<'a>) -> bool
pub fn contains(&self, entry: &BlockTreeEntry<'a>) -> bool
Checks if the given block entry is part of the active chain.
Sourcepub fn iter(&self) -> ChainIterator<'a> ⓘ
pub fn iter(&self) -> ChainIterator<'a> ⓘ
Returns an iterator over all blocks from genesis to tip.
pub fn height(&self) -> i32
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Chain<'a>
impl<'a> RefUnwindSafe for Chain<'a>
impl<'a> !Send for Chain<'a>
impl<'a> !Sync for Chain<'a>
impl<'a> Unpin for Chain<'a>
impl<'a> UnwindSafe for Chain<'a>
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