mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-07-31 04:21:23 +00:00
improve on api
This commit is contained in:
@@ -67,7 +67,7 @@ impl Entry {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_bytes(consensus_branch_id: u32, buf: &[u8]) -> std::io::Result<Self> {
|
pub fn from_bytes<T: AsRef<[u8]>>(consensus_branch_id: u32, buf: T) -> std::io::Result<Self> {
|
||||||
let mut cursor = std::io::Cursor::new(buf);
|
let mut cursor = std::io::Cursor::new(buf);
|
||||||
Self::read(consensus_branch_id, &mut cursor)
|
Self::read(consensus_branch_id, &mut cursor)
|
||||||
}
|
}
|
||||||
|
@@ -154,7 +154,7 @@ impl NodeData {
|
|||||||
buf[0..pos].to_vec()
|
buf[0..pos].to_vec()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_bytes(consensus_branch_id: u32, buf: &[u8]) -> std::io::Result<Self> {
|
pub fn from_bytes<T: AsRef<[u8]>>(consensus_branch_id: u32, buf: T) -> std::io::Result<Self> {
|
||||||
let mut cursor = std::io::Cursor::new(buf);
|
let mut cursor = std::io::Cursor::new(buf);
|
||||||
Self::read(consensus_branch_id, &mut cursor)
|
Self::read(consensus_branch_id, &mut cursor)
|
||||||
}
|
}
|
||||||
|
@@ -267,7 +267,7 @@ impl Tree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct IndexedNode<'a> {
|
pub struct IndexedNode<'a> {
|
||||||
node: &'a Entry,
|
node: &'a Entry,
|
||||||
link: EntryLink,
|
link: EntryLink,
|
||||||
@@ -290,6 +290,10 @@ impl<'a> IndexedNode<'a> {
|
|||||||
pub fn data(&self) -> &NodeData {
|
pub fn data(&self) -> &NodeData {
|
||||||
&self.node.data
|
&self.node.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn link(&self) -> EntryLink {
|
||||||
|
self.link
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn combine_nodes<'a>(left: IndexedNode<'a>, right: IndexedNode<'a>) -> Entry {
|
fn combine_nodes<'a>(left: IndexedNode<'a>, right: IndexedNode<'a>) -> Entry {
|
||||||
|
Reference in New Issue
Block a user