From 66c29d601c84f52b0f2001f449bf1314ea26358f Mon Sep 17 00:00:00 2001 From: John Date: Wed, 27 Mar 2024 01:25:19 -0500 Subject: [PATCH] cl-structures: Tree cleanup --- cl-structures/src/tree.rs | 3 +++ cl-structures/src/tree/tree_ref.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cl-structures/src/tree.rs b/cl-structures/src/tree.rs index d6f1c18..d099596 100644 --- a/cl-structures/src/tree.rs +++ b/cl-structures/src/tree.rs @@ -158,6 +158,9 @@ impl Node { std::mem::replace(&mut self.value, value) } + pub fn parent(&self) -> Option> { + self.parent + } pub fn children(&self) -> &[Ref] { &self.children } diff --git a/cl-structures/src/tree/tree_ref.rs b/cl-structures/src/tree/tree_ref.rs index 5cf0997..5ea27af 100644 --- a/cl-structures/src/tree/tree_ref.rs +++ b/cl-structures/src/tree/tree_ref.rs @@ -10,7 +10,7 @@ use std::{marker::PhantomData, num::NonZeroUsize}; pub struct Ref(NonZeroUsize, PhantomData); impl Ref { - /// Constructs a new [TreeRef] with the given index + /// Constructs a new [Ref] with the given index pub fn new_unchecked(index: usize) -> Self { // Safety: index cannot be zero because we use saturating addition on unsigned type. Self(