added as_leaf in AnyNode impl (#44)

Co-authored-by: Dafydd Durairaj <dafydd.durairaj@gmail.com>
This commit is contained in:
dafyddd 2020-12-06 17:38:26 -05:00 committed by GitHub
parent cb43d3707f
commit 7d7ce24d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -214,6 +214,14 @@ impl AnyNode {
}
}
#[inline]
pub fn as_leaf(&self) -> Option<&LeafNode> {
match self.case() {
Some(NodeRef::Leaf(leaf_ref)) => Some(leaf_ref),
_ => None,
}
}
#[inline]
pub fn as_leaf_mut(&mut self) -> Option<&mut LeafNode> {
match self.case_mut() {