pub struct ProofNode {
pub goal: Term,
pub rule_cid: Option<Cid>,
pub peer: Option<String>,
pub children: Vec<ProofNode>,
pub resolved: bool,
pub depth: usize,
}Expand description
A single node in the distributed proof tree.
Each node corresponds to one goal in the proof. When a goal is proved
locally the peer field is None; when it is resolved by a remote peer
the field holds that peer’s string identifier (PeerId encoded as a string).
Fields§
§goal: TermThe goal that this node proves.
rule_cid: Option<Cid>CID of the rule that was applied to prove this goal.
None when the goal was satisfied by a base fact (no rule body).
peer: Option<String>Peer that resolved this goal.
None means the resolution was performed locally.
children: Vec<ProofNode>Child nodes corresponding to the sub-goals in the applied rule body.
resolved: boolWhether this node (and all its children) were fully resolved.
depth: usizeDepth of this node in the tree (root is 0).
Implementations§
Source§impl ProofNode
impl ProofNode
Sourcepub fn fact(goal: Term, depth: usize, peer: Option<String>) -> Self
pub fn fact(goal: Term, depth: usize, peer: Option<String>) -> Self
Construct a resolved leaf node (fact, no rule body).
§Arguments
goal– The goal term that was proved.depth– Depth of this node in the tree.peer–Nonefor local,Some(peer_id)for remote.
Sourcepub fn unresolved(goal: Term, depth: usize) -> Self
pub fn unresolved(goal: Term, depth: usize) -> Self
Construct an unresolved node (goal could not be proved).
Sourcepub fn from_rule(
goal: Term,
rule_cid: Option<Cid>,
children: Vec<ProofNode>,
depth: usize,
peer: Option<String>,
) -> Self
pub fn from_rule( goal: Term, rule_cid: Option<Cid>, children: Vec<ProofNode>, depth: usize, peer: Option<String>, ) -> Self
Construct a node that was resolved via a rule.
§Arguments
goal– The goal term that was proved.rule_cid– Content ID of the applied rule.children– Sub-goal nodes for the rule body.depth– Depth of this node in the tree.peer–Nonefor local,Some(peer_id)for remote.
Sourcepub fn contributing_peers(&self) -> Vec<String>
pub fn contributing_peers(&self) -> Vec<String>
Collect all peers that contributed to this subtree.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ProofNode
impl<'de> Deserialize<'de> for ProofNode
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>,
Auto Trait Implementations§
impl Freeze for ProofNode
impl RefUnwindSafe for ProofNode
impl Send for ProofNode
impl Sync for ProofNode
impl Unpin for ProofNode
impl UnsafeUnpin for ProofNode
impl UnwindSafe for ProofNode
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more