Skip to main content

GraphBuilder

Struct GraphBuilder 

Source
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

Source

pub fn new(limits: Limits) -> Self

An empty graph with the given entry limits.

Source

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.

Source

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).

Source

pub fn stutter(&mut self, from: u64) -> Result<(), Verdict>

The implicit stutter of the fully expanded source from.

§Errors

The capture’s edge limit.

Source

pub fn graph(&self) -> &BehaviorGraph

The graph so far.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for GraphBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.