mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-22 21:07:43 +00:00
chore: refine debug info
This commit is contained in:
parent
3b091d8891
commit
ec209f233e
3 changed files with 13 additions and 1 deletions
|
@ -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<T>> {
|
||||
Internal(InternalNode<'a, T, A>),
|
||||
Leaf(LeafNode<'a, T, A>),
|
||||
|
@ -250,3 +251,12 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> HasLength for Node<'a, T, A> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Rle, A: RleTreeTrait<T>> 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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -401,6 +401,7 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> 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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,6 +258,7 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> 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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue