diff --git a/crates/rle/src/rle_tree/node.rs b/crates/rle/src/rle_tree/node.rs index 29f71bde..38e0b6be 100644 --- a/crates/rle/src/rle_tree/node.rs +++ b/crates/rle/src/rle_tree/node.rs @@ -1,4 +1,5 @@ use std::{ + fmt::Debug, marker::{PhantomData, PhantomPinned}, ptr::NonNull, }; @@ -12,7 +13,7 @@ mod internal_impl; mod leaf_impl; pub(crate) mod node_trait; -#[derive(Debug, EnumAsInner)] +#[derive(EnumAsInner)] pub enum Node<'a, T: Rle, A: RleTreeTrait> { Internal(InternalNode<'a, T, A>), Leaf(LeafNode<'a, T, A>), @@ -250,3 +251,12 @@ impl<'a, T: Rle, A: RleTreeTrait> HasLength for Node<'a, T, A> { } } } + +impl<'a, T: Rle, A: RleTreeTrait> Debug for Node<'a, T, A> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Internal(arg0) => arg0.fmt(f), + Self::Leaf(arg0) => arg0.fmt(f), + } + } +} diff --git a/crates/rle/src/rle_tree/node/internal_impl.rs b/crates/rle/src/rle_tree/node/internal_impl.rs index 6c625bd0..fbff3c48 100644 --- a/crates/rle/src/rle_tree/node/internal_impl.rs +++ b/crates/rle/src/rle_tree/node/internal_impl.rs @@ -401,6 +401,7 @@ impl<'a, T: Rle, A: RleTreeTrait> Debug for InternalNode<'a, T, A> { let mut debug_struct = f.debug_struct("InternalNode"); debug_struct.field("children", &self.children); debug_struct.field("cache", &self.cache); + debug_struct.field("children_num", &self.children.len()); debug_struct.finish() } } diff --git a/crates/rle/src/rle_tree/node/leaf_impl.rs b/crates/rle/src/rle_tree/node/leaf_impl.rs index 5148bd6a..444b80e8 100644 --- a/crates/rle/src/rle_tree/node/leaf_impl.rs +++ b/crates/rle/src/rle_tree/node/leaf_impl.rs @@ -258,6 +258,7 @@ impl<'a, T: Rle, A: RleTreeTrait> Debug for LeafNode<'a, T, A> { let mut debug_struct = f.debug_struct("LeafNode"); debug_struct.field("children", &self.children); debug_struct.field("cache", &self.cache); + debug_struct.field("children_num", &self.children.len()); debug_struct.finish() } }