Trait contrafact::Fact
source · pub trait Fact<'a, T>where
T: Bounds<'a>,{
// Required methods
fn mutate(&self, obj: T, g: &mut Generator<'a>) -> Mutation<T>;
fn advance(&mut self, obj: &T);
// Provided methods
fn check(&self, obj: &T) -> Check { ... }
fn satisfy(&mut self, obj: T, g: &mut Generator<'a>) -> ContrafactResult<T> { ... }
fn build_fallible(&mut self, g: &mut Generator<'a>) -> ContrafactResult<T> { ... }
fn build(&mut self, g: &mut Generator<'a>) -> 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§
Provided Methods§
sourcefn satisfy(&mut self, obj: T, g: &mut Generator<'a>) -> ContrafactResult<T>
fn satisfy(&mut self, obj: T, g: &mut Generator<'a>) -> ContrafactResult<T>
Mutate a value such that it satisfies the constraint. If the constraint cannot be satisfied, panic.
sourcefn build_fallible(&mut self, g: &mut Generator<'a>) -> ContrafactResult<T>
fn build_fallible(&mut self, g: &mut Generator<'a>) -> ContrafactResult<T>
Build a new value such that it satisfies the constraint