Trait quickcheck::Arbitrary[][src]

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

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

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

Provided methods

Implementations on Foreign Types

Implementors