Add accessors to private frontier elements.
This commit is contained in:
parent
909f0d6224
commit
6d527c7a67
|
@ -158,6 +158,14 @@ impl<H> NonEmptyFrontier<H> {
|
|||
pub fn size(&self) -> usize {
|
||||
self.position.0 + 1
|
||||
}
|
||||
|
||||
pub fn leaf(&self) -> &Leaf<H> {
|
||||
&self.leaf
|
||||
}
|
||||
|
||||
pub fn ommers(&self) -> &Vec<H> {
|
||||
&self.ommers
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: Clone> NonEmptyFrontier<H> {
|
||||
|
@ -338,6 +346,12 @@ impl<H, const DEPTH: u8> Frontier<H, DEPTH> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Return the wrapped NonEmptyFrontier reference, or None if
|
||||
/// the frontier is empty.
|
||||
pub fn value(&self) -> Option<&NonEmptyFrontier<H>> {
|
||||
self.frontier.as_ref()
|
||||
}
|
||||
|
||||
/// Returns the position of latest leaf appended to the frontier,
|
||||
/// if the frontier is nonempty.
|
||||
pub fn position(&self) -> Option<Position> {
|
||||
|
|
Loading…
Reference in New Issue