[][src]Struct proof::cache::Cache

pub struct Cache { /* fields omitted */ }

Stores the mapping of nodes to their chunks.

Methods

impl Cache[src]

pub fn new() -> Self[src]

Instantiate an empty Cache.

pub fn get(&self, index: NodeIndex) -> Option<&Vec<u8>>[src]

Gets a reference to the chunk coresponding to the node index.

pub fn insert(&mut self, index: NodeIndex, chunk: Vec<u8>) -> Option<Vec<u8>>[src]

Sets the chunk for the node index and returns the old value.

pub fn nodes(&self) -> Vec<NodeIndex>[src]

Retrieves a vector of set node indicies.

pub fn contains_node(&self, index: NodeIndex) -> bool[src]

Returns true if the cache contains a chunk for the specified node index.

pub fn is_valid(&self, root: Vec<u8>) -> bool[src]

Determines if the current merkle tree is valid.

pub fn fill(&mut self) -> Result<(), Error>[src]

Inserts missing nodes into the merkle tree that can be generated from existing nodes.

pub fn refresh(&mut self) -> Result<(), Error>[src]

Trait Implementations

impl PartialEq<Cache> for Cache[src]

impl Default for Cache[src]

impl Clone for Cache[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Cache[src]

impl Index<usize> for Cache[src]

type Output = Vec<u8>

The returned type after indexing.

Auto Trait Implementations

impl Send for Cache

impl Unpin for Cache

impl Sync for Cache

impl UnwindSafe for Cache

impl RefUnwindSafe for Cache

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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

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

type Output = T

Should always be Self