Trait quickcheck::Arbitrary [] [src]

pub trait Arbitrary: Clone + Send + 'static {
    fn arbitrary<G: Gen>(g: &mut G) -> Self;

    fn shrink(&self) -> Box<Iterator<Item=Self>> { ... }
}

Arbitrary describes types whose values can be randomly generated and shrunk.

Aside from shrinking, Arbitrary is different from the std::Rand trait in that it uses a Gen to control the distribution of random values.

As of now, all types that implement Arbitrary must also implement Clone. (I'm not sure if this is a permanent restriction.)

They must also be sendable and static since every test is run in its own thread using thread::Builder::spawn, which requires the Send + 'static bounds.

Required Methods

fn arbitrary<G: Gen>(g: &mut G) -> Self

Provided Methods

fn shrink(&self) -> Box<Iterator<Item=Self>>

Implementors