Arbitrary Ext
Since 1.2.0 Arbitrary supports custom arbitrary implementation for fields on derive.
But it still remains tricky, if a type that does not implement Arbitrary is wrapped into a generic type.
This crate provides s set of function combinators to support the containers and collections form the standard library.
See the example below.
Usage
use ;
use HashMap;
// Imagine this is a foreign type, that by some reason does not implement Arbitrary trait.
;
// Our custom function to generate arbitrary Number out of Unstructured.
Without having arbitrary_option, arbitrary_vec, arbitrary_hash_map combinators, would be forced to implement out custom functions to generate
arbitrary Option<Number>, Vec<Number> and HashMap<Number, Vec<Option<Number>>>. e.g.:
;
;
;
But this becomes tedious very quickly.
History of the crate
Initially the crate was created to workaround this Arbitrary issue but it was later addressed in this PR.