I am trying to use quickcheck in Rust. I want to define my enum as an instance Arbitrary, so I can use it in tests.
extern crate quickcheck;
use quickcheck::{Arbitrary,Gen};
enum Animal {
Cat,
Dog,
Mouse
}
impl Arbitrary for Animal {
fn arbitrary<G: Gen>(g: &mut G) -> Animal {
let i = g.next_u32();
match i % 3 {
0 => Animal::Cat,
1 => Animal::Dog,
2 => Animal::Mouse,
}
}
}
However, this gives me a compilation error:
src/main.rs:18:17: 18:29 error: source trait is private
src/main.rs:18 let i = g.next_u32();
^~~~~~~~~~~~
What causes this error? I know that this problem is with rust , but since it is Genimported, I would think what I can call .next_u32.
source
share