I use quickcheck to check some properties of my code. At some point, I need an ASCII byte, so I tried to write an implementation Arbitraryas follows:
extern crate quickcheck;
use quickcheck::{quickcheck,Arbitrary,Gen};
struct AsciiChar(u8);
impl Arbitrary for AsciiChar {
fn arbitrary<G>(g: &mut G) -> AsciiChar
where G: Gen
{
let a: u8 = g.gen_range(0, 128);
AsciiChar(a)
}
}
fn it_works() {}
Error with error:
src/lib.rs:12:21: 12:40 error: source trait is private
src/lib.rs:12 let a: u8 = g.gen_range(0, 128);
^~~~~~~~~~~~~~~~~~~
Some searches led me to various error messages ( 1 , 2 , 3 , 4 ) that everything seems like I need a usesuperwrite Genthat rand::Rng. I updated my boxes and used instructions for
extern crate quickcheck;
extern crate rand;
use rand::Rng;
use quickcheck::{quickcheck,Arbitrary,Gen};
But I keep getting the same error.
I tried with
rustc version 1.1.0-dev (b402c43f0 2015-05-07) (built 2015-05-07)rustc 1.1.0-dev (3ca008dcf 2015-05-12) (built 2015-05-12)
I also use quickcheck v0.2.18
source
share