Trait contrafact::Fact [−][src]
pub trait Fact<T> where
T: Bounds, { fn check(&self, obj: &T) -> Check; fn mutate(&self, obj: &mut T, u: &mut Unstructured<'static>); fn advance(&mut self, obj: &T); fn satisfy(&mut self, obj: &mut T, u: &mut Unstructured<'static>) { ... } fn build(&mut self, u: &mut Unstructured<'static>) -> T { ... } }
Expand description
A declarative representation of a constraint on some data, which can be used to both make an assertion (check) or to mold some arbitrary existing data into a shape which passes that same assertion (mutate)
Required methods
fn check(&self, obj: &T) -> Check
[src]
Expand description
Assert that the constraint is satisfied (panic if not).
fn mutate(&self, obj: &mut T, u: &mut Unstructured<'static>)
[src]
Expand description
Apply a mutation which moves the obj closer to satisfying the overall constraint.
fn advance(&mut self, obj: &T)
[src]
Expand description
When checking or mutating a sequence of items, this gets called after each item to modify the state to get ready for the next item.
Provided methods
fn satisfy(&mut self, obj: &mut T, u: &mut Unstructured<'static>)
[src]
Expand description
Mutate a value such that it satisfies the constraint. If the constraint cannot be satisfied, panic.
fn build(&mut self, u: &mut Unstructured<'static>) -> T
[src]
Expand description
Build a new value such that it satisfies the constraint