[][src]Struct tree_index::Proof

pub struct Proof<'a> { /* fields omitted */ }

A merkle proof for an index.

Merkle trees are proven by checking the parent hashes.

Implementations

impl<'a> Proof<'a>[src]

pub fn new(index: u64, verified_by: u64, nodes: &'a [u64]) -> Self[src]

Create a new instance.

Examples

let nodes = vec![];
let _proof = Proof::new(0, 0, &nodes);

pub fn index(&self) -> u64[src]

Get the index which was used to verify this node.

Examples

let nodes = vec![];
let proof = Proof::new(0, 0, &nodes);
assert_eq!(proof.index(), 0);

pub fn verified_by(&self) -> u64[src]

Get the index for the node which verifies the input index.

Examples

let nodes = vec![];
let proof = Proof::new(0, 0, &nodes);
assert_eq!(proof.verified_by(), 0);

pub fn nodes(&self) -> &[u64][src]

Merkle proof for the index you pass, written in flat-tree notation.

Examples

let nodes = vec![];
let proof = Proof::new(0, 0, &nodes);
assert_eq!(proof.nodes().len(), 0);

Trait Implementations

impl<'a> Debug for Proof<'a>[src]

impl<'a> PartialEq<Proof<'a>> for Proof<'a>[src]

impl<'a> StructuralPartialEq for Proof<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Proof<'a>

impl<'a> Send for Proof<'a>

impl<'a> Sync for Proof<'a>

impl<'a> Unpin for Proof<'a>

impl<'a> UnwindSafe for Proof<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.