diff --git a/src/entry.rs b/src/entry.rs index 59663fc..982b879 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -67,7 +67,7 @@ impl Entry { }) } - pub fn from_bytes(consensus_branch_id: u32, buf: &[u8]) -> std::io::Result { + pub fn from_bytes>(consensus_branch_id: u32, buf: T) -> std::io::Result { let mut cursor = std::io::Cursor::new(buf); Self::read(consensus_branch_id, &mut cursor) } diff --git a/src/node_data.rs b/src/node_data.rs index fd01c3a..dcc8ded 100644 --- a/src/node_data.rs +++ b/src/node_data.rs @@ -154,7 +154,7 @@ impl NodeData { buf[0..pos].to_vec() } - pub fn from_bytes(consensus_branch_id: u32, buf: &[u8]) -> std::io::Result { + pub fn from_bytes>(consensus_branch_id: u32, buf: T) -> std::io::Result { let mut cursor = std::io::Cursor::new(buf); Self::read(consensus_branch_id, &mut cursor) } diff --git a/src/tree.rs b/src/tree.rs index 36c3e4e..b816287 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -267,7 +267,7 @@ impl Tree { } } - +#[derive(Debug)] pub struct IndexedNode<'a> { node: &'a Entry, link: EntryLink, @@ -290,6 +290,10 @@ impl<'a> IndexedNode<'a> { pub fn data(&self) -> &NodeData { &self.node.data } + + pub fn link(&self) -> EntryLink { + self.link + } } fn combine_nodes<'a>(left: IndexedNode<'a>, right: IndexedNode<'a>) -> Entry {