Struct tree_index::TreeIndex [−][src]
pub struct TreeIndex { /* fields omitted */ }Index a tree structure or something.
Methods
impl TreeIndex[src]
impl TreeIndexpub fn new(bitfield: Bitfield) -> Self[src]
pub fn new(bitfield: Bitfield) -> SelfCreate a new TreeIndex by passing it a sparse_bitfield instance.
pub fn get(&mut self, index: usize) -> bool[src]
pub fn get(&mut self, index: usize) -> boolGet a bit from the bitfield.
pub fn set(&mut self, index: usize) -> Change[src]
pub fn set(&mut self, index: usize) -> ChangeSet an index on the tree to true, and also all of the parents to the
index. Walks the flat-tree upward, until it finds the upper most node.
pub fn proof<'a>(
&'a mut self,
index: usize,
include_hash: bool,
nodes: &'a mut impl AsMut<Vec<usize>>,
remote_tree: &mut Self
) -> Option<Proof>[src]
pub fn proof<'a>(
&'a mut self,
index: usize,
include_hash: bool,
nodes: &'a mut impl AsMut<Vec<usize>>,
remote_tree: &mut Self
) -> Option<Proof>Prove a method.
pub fn proof_with_digest<'a>(
&'a mut self,
index: usize,
digest: usize,
include_hash: bool,
nodes: &'a mut impl AsMut<Vec<usize>>,
remote_tree: &mut Self
) -> Option<Proof>[src]
pub fn proof_with_digest<'a>(
&'a mut self,
index: usize,
digest: usize,
include_hash: bool,
nodes: &'a mut impl AsMut<Vec<usize>>,
remote_tree: &mut Self
) -> Option<Proof>Determine which Nodes prove the correctness for the Node at index.
The passed buffer is filled with nodes that are verified by the same index. This is done so allocations can happen at the top level, and a buffer (pool) can be used to prevent extra allocations.
pub fn digest(&mut self, index: usize) -> usize[src]
pub fn digest(&mut self, index: usize) -> usizeCreate a digest for data at index.
pub fn blocks(&mut self) -> usize[src]
pub fn blocks(&mut self) -> usizeGet the position of the highest entry in the tree. Aka max.
NOTE: should we rename this to .len() ?
pub fn roots(&mut self, roots: &mut Vec<usize>)[src]
pub fn roots(&mut self, roots: &mut Vec<usize>)Get all root nodes.
TODO: don't make this allocate, but fill a vector instead.
pub fn verified_by(&mut self, index: usize) -> Verification[src]
pub fn verified_by(&mut self, index: usize) -> VerificationFind the node that verified the node that's passed.
This is different from the Javascript implementation in that it doesn't
push the top value into an array, but returns it instead through the
Verification type.
Trait Implementations
impl Debug for TreeIndex[src]
impl Debug for TreeIndexfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Default for TreeIndex[src]
impl Default for TreeIndexCreate a TreeIndex with an empty sparse_bitfield instance with a page size
of 1024.