Trait Chain

Source
pub trait Chain {
    // Required methods
    fn len(&self) -> usize;
    fn level(&self, did: &str) -> Option<usize>;
    fn root(&self) -> &str;
    fn leaf(&self) -> &str;
    fn upstream(&self, did: &str) -> Option<&String>;
    fn downstream(&self, did: &str) -> Option<&String>;
    fn data(&self, did: &str) -> Option<&(Document, DocumentMetadata)>;
    fn verify_proofs(&self) -> Result<(), ChainError>;
    fn level_vec(&self) -> &Vec<String>;

    // Provided methods
    fn to_vec(&self) -> Vec<(Document, DocumentMetadata)> { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

A chain of DIDs.

Required Methods§

Source

fn len(&self) -> usize

Returns the length of the DID chain.

Source

fn level(&self, did: &str) -> Option<usize>

Returns the level of the given DID in the chain.

Source

fn root(&self) -> &str

Gets the root DID.

Source

fn leaf(&self) -> &str

Gets the leaf node DID.

Source

fn upstream(&self, did: &str) -> Option<&String>

Gets the next upstream DID.

Source

fn downstream(&self, did: &str) -> Option<&String>

Gets the next downstream DID.

Source

fn data(&self, did: &str) -> Option<&(Document, DocumentMetadata)>

Gets data for the given DID.

Source

fn verify_proofs(&self) -> Result<(), ChainError>

Verify all of the proofs in the chain.

Source

fn level_vec(&self) -> &Vec<String>

Returns a vector of DID strings ordered by the level in the chain, starting at the root (level 0).

Provided Methods§

Source

fn to_vec(&self) -> Vec<(Document, DocumentMetadata)>

Returns a vector of Documents and Document Metadata for each DID ordered by the level in the chain, starting at the root (level 0).

Source

fn is_empty(&self) -> bool

Returns whether the Chain is empty

Implementors§