diff --git a/crates/rle/src/rle_tree/node.rs b/crates/rle/src/rle_tree/node.rs index de4a3b45..51ffc5da 100644 --- a/crates/rle/src/rle_tree/node.rs +++ b/crates/rle/src/rle_tree/node.rs @@ -18,7 +18,6 @@ pub enum Node<'a, T: Rle, A: RleTreeTrait> { Leaf(BumpBox<'a, LeafNode<'a, T, A>>), } -#[derive(Debug)] pub struct InternalNode<'a, T: Rle, A: RleTreeTrait> { bump: &'a Bump, parent: Option>>, @@ -28,7 +27,6 @@ pub struct InternalNode<'a, T: Rle, A: RleTreeTrait> { _a: PhantomData, } -#[derive(Debug)] pub struct LeafNode<'a, T: Rle, A: RleTreeTrait> { bump: &'a Bump, parent: NonNull>, diff --git a/crates/rle/src/rle_tree/node/internal_impl.rs b/crates/rle/src/rle_tree/node/internal_impl.rs index ea53818e..1070244f 100644 --- a/crates/rle/src/rle_tree/node/internal_impl.rs +++ b/crates/rle/src/rle_tree/node/internal_impl.rs @@ -1,3 +1,5 @@ +use std::fmt::{Debug, Error, Formatter}; + use crate::{rle_tree::tree_trait::Position, HasLength}; use super::*; @@ -396,3 +398,12 @@ impl<'a, T: Rle, A: RleTreeTrait> InternalNode<'a, T, A> { } } } + +impl<'a, T: Rle, A: RleTreeTrait> Debug for InternalNode<'a, T, A> { + fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { + let mut debug_struct = f.debug_struct("InternalNode"); + debug_struct.field("children", &self.children); + debug_struct.field("cache", &self.cache); + 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 5a7ce1f4..24615f19 100644 --- a/crates/rle/src/rle_tree/node/leaf_impl.rs +++ b/crates/rle/src/rle_tree/node/leaf_impl.rs @@ -1,4 +1,5 @@ use crate::{rle_tree::tree_trait::Position, HasLength}; +use std::fmt::{Debug, Error, Formatter}; use super::*; @@ -239,3 +240,12 @@ impl<'a, T: Rle, A: RleTreeTrait> HasLength for LeafNode<'a, T, A> { A::len_leaf(self) } } + +impl<'a, T: Rle, A: RleTreeTrait> Debug for LeafNode<'a, T, A> { + fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { + let mut debug_struct = f.debug_struct("LeafNode"); + debug_struct.field("children", &self.children); + debug_struct.field("cache", &self.cache); + debug_struct.finish() + } +}