pub struct ProvenanceChain { /* private fields */ }Expand description
A collection of provenance nodes forming one or more chains.
Implementations§
Source§impl ProvenanceChain
impl ProvenanceChain
Sourcepub fn add_node(
&mut self,
claim: &str,
evidence: Evidence,
producer: &str,
parent_id: Option<&str>,
) -> &ProvenanceNode
pub fn add_node( &mut self, claim: &str, evidence: Evidence, producer: &str, parent_id: Option<&str>, ) -> &ProvenanceNode
Add a new provenance node and return a reference to it.
Node IDs are auto-generated using a monotonic counter (prov-1, prov-2, …).
Sourcepub fn trace_to_root(&self, node_id: &str) -> Vec<&ProvenanceNode>
pub fn trace_to_root(&self, node_id: &str) -> Vec<&ProvenanceNode>
Trace from a node back to the root, returning nodes in leaf-to-root order.
Sourcepub fn get_roots(&self) -> Vec<&ProvenanceNode>
pub fn get_roots(&self) -> Vec<&ProvenanceNode>
Return all root nodes (nodes with no parent).
Sourcepub fn get_leaves(&self) -> Vec<&ProvenanceNode>
pub fn get_leaves(&self) -> Vec<&ProvenanceNode>
Return all leaf nodes (nodes that are not referenced as a parent by any other node).
Sourcepub fn weakest_link(&self, node_id: &str) -> EvidenceClass
pub fn weakest_link(&self, node_id: &str) -> EvidenceClass
Return the weakest EvidenceClass along the chain from a node to root.
Sourcepub fn chain_confidence(&self, node_id: &str) -> f64
pub fn chain_confidence(&self, node_id: &str) -> f64
Compute the product of confidence values along the chain from a node to root.
Returns 0.0 if the node is not found.
Trait Implementations§
Source§impl Clone for ProvenanceChain
impl Clone for ProvenanceChain
Source§fn clone(&self) -> ProvenanceChain
fn clone(&self) -> ProvenanceChain
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProvenanceChain
impl Debug for ProvenanceChain
Source§impl Default for ProvenanceChain
impl Default for ProvenanceChain
Source§impl<'de> Deserialize<'de> for ProvenanceChain
impl<'de> Deserialize<'de> for ProvenanceChain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProvenanceChain
impl RefUnwindSafe for ProvenanceChain
impl Send for ProvenanceChain
impl Sync for ProvenanceChain
impl Unpin for ProvenanceChain
impl UnsafeUnpin for ProvenanceChain
impl UnwindSafe for ProvenanceChain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more