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> + 'static> { ... }
}

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 since every test is run inside its own task. (This permits failures to include task failures.)

Required Methods

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

Provided Methods

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

Implementors