pub struct GraphBuilder { /* private fields */ }Expand description
A behavior graph built by a producer outside this crate, such as the execution core: the same collector, limits and messages as capture through the shared safety engine, and the same completion checks.
The producer reports, in its commit order, each accepted state inside the
model (Self::record) and each fully expanded source
(Self::stutter), as the shared engine does. States are identified by
a caller key; equal keys are one vertex. Before the search, the producer
applies refusal.
use dive_runtime::capture::{GraphBuilder, Limits};
use dive_eval::next::StateVals;
let mut graph = GraphBuilder::new(Limits::default());
let s: StateVals = vec![Some(dive_value::Value::Bool(true))].into();
graph.record(7, s.clone(), Some(0), None, 0, "Init")?;
graph.record(7, s, None, Some(0), 0, "Next")?;
graph.stutter(0)?;
assert_eq!(graph.graph().edges[0].len(), 2);
assert_eq!(graph.graph().roots, [0]);Implementations§
Source§impl GraphBuilder
impl GraphBuilder
Sourcepub fn allow_emitted(
&self,
generated: u64,
ordinal: Option<u64>,
) -> Result<(), Verdict>
pub fn allow_emitted( &self, generated: u64, ordinal: Option<u64>, ) -> Result<(), Verdict>
Admits the generated-th generated state, emitted at ordinal of its
source (None for an initial state), before its checks.
§Errors
The capture’s generated-state or per-source resource limit.
Sourcepub fn record(
&mut self,
key: u64,
state: StateVals,
id: Option<u64>,
parent: Option<u64>,
ordinal: u64,
label: &str,
) -> Result<(), Verdict>
pub fn record( &mut self, key: u64, state: StateVals, id: Option<u64>, parent: Option<u64>, ordinal: u64, label: &str, ) -> Result<(), Verdict>
Records an accepted state inside the model with key key and values
state. id is its new discovery index when it is new, None when it
was seen. parent is the expanded source (None for an initial
state), ordinal its emission index there and label the action’s
label.
§Errors
A capture resource limit, or an id that is not the next discovery index (an internal error).
Sourcepub fn graph(&self) -> &BehaviorGraph
pub fn graph(&self) -> &BehaviorGraph
The graph so far.
Sourcepub fn complete(
self,
safety: CheckResult,
options: CheckOptions,
) -> Result<Complete, Verdict>
pub fn complete( self, safety: CheckResult, options: CheckOptions, ) -> Result<Complete, Verdict>
The completed exploration: safety is the producer’s successful
safety result, with its statistics.
§Errors
The original non-success safety verdict, missing statistics, or a graph whose shape disagrees with them (internal errors), or a capture entry limit.
Sourcepub fn prefix(
self,
level: u64,
safety: CheckResult,
options: CheckOptions,
) -> Result<Prefix, Verdict>
pub fn prefix( self, level: u64, safety: CheckResult, options: CheckOptions, ) -> Result<Prefix, Verdict>
The exploration stopped after the fully committed level, whose
frontier is not exhausted.
§Errors
The original non-success safety verdict, missing statistics or an exhausted frontier (internal errors). Successful unexhausted prefixes remain incomplete and cannot establish a holding temporal verdict.