pub enum TrieFnState<A, T> {
Simulate {
trace: Trace<A, Trie<(Rc<dyn Any>, f64)>, T>,
},
Generate {
trace: Trace<A, Trie<(Rc<dyn Any>, f64)>, T>,
weight: f64,
constraints: Trie<Rc<dyn Any>>,
},
Update {
trace: Trace<A, Trie<(Rc<dyn Any>, f64)>, T>,
constraints: Trie<Rc<dyn Any>>,
weight: f64,
discard: Trie<Rc<dyn Any>>,
visitor: AddrTrie,
},
}Expand description
Incremental computational state of a trace during the execution of the different GenFn methods with a TrieFn.
Variants§
Simulate
State for executing GenFn::simulate in a TrieFn.
Generate
State for executing GenFn::generate in a TrieFn.
Update
State for executing GenFn::update in a TrieFn.
Implementations§
Source§impl<A: 'static, T: 'static> TrieFnState<A, T>
impl<A: 'static, T: 'static> TrieFnState<A, T>
Sourcepub fn sample_at<V: Clone + 'static, W: Clone + 'static>(
&mut self,
dist: &impl Distribution<V, W>,
args: W,
addr: &str,
) -> V
pub fn sample_at<V: Clone + 'static, W: Clone + 'static>( &mut self, dist: &impl Distribution<V, W>, args: W, addr: &str, ) -> V
Sample a random value from a distribution and insert it into the self.trace.data trie as a weighted leaf node.
Return a clone of the sampled value.
Sourcepub fn trace_at<X: Clone + 'static, Y: Clone + 'static>(
&mut self,
gen_fn: &impl GenFn<X, Trie<(Rc<dyn Any>, f64)>, Y>,
args: X,
addr: &str,
) -> Y
pub fn trace_at<X: Clone + 'static, Y: Clone + 'static>( &mut self, gen_fn: &impl GenFn<X, Trie<(Rc<dyn Any>, f64)>, Y>, args: X, addr: &str, ) -> Y
Recursively sample a trace from another gen_fn.
Insert its subtrace.data trie as a weighted internal node of the current trace.data trie.
Insert its retv as a (zero-weighted) internal node of the current trace.data trie.
Return a clone of the retv.
Auto Trait Implementations§
impl<A, T> Freeze for TrieFnState<A, T>
impl<A, T> !RefUnwindSafe for TrieFnState<A, T>
impl<A, T> !Send for TrieFnState<A, T>
impl<A, T> !Sync for TrieFnState<A, T>
impl<A, T> Unpin for TrieFnState<A, T>
impl<A, T> !UnwindSafe for TrieFnState<A, T>
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.