chore(trie): TrieOp::as_update (#9076)

This commit is contained in:
Roman Krasiuk
2024-06-25 02:07:18 -07:00
committed by GitHub
parent c885257e52
commit aac16ac606

View File

@ -38,6 +38,15 @@ impl TrieOp {
pub const fn is_update(&self) -> bool {
matches!(self, Self::Update(..))
}
/// Returns reference to updated branch node if operation is [`Self::Update`].
pub const fn as_update(&self) -> Option<&BranchNodeCompact> {
if let Self::Update(node) = &self {
Some(node)
} else {
None
}
}
}
/// The aggregation of trie updates.