use crate::{BoxGen, BoxIter, BoxShrink, ExampleSize, Gen, Seed};
pub fn other_shrinker<E: Clone + 'static>(
generator: BoxGen<E>,
other_shrink: BoxShrink<E>,
) -> BoxGen<E> {
Box::new(OtherShrinkGen {
generator,
shrinker: other_shrink,
})
}
#[derive(Clone)]
struct OtherShrinkGen<E> {
generator: BoxGen<E>,
shrinker: BoxShrink<E>,
}
impl<E: Clone + 'static> Gen<E> for OtherShrinkGen<E> {
fn examples(&self, seed: Seed, size: ExampleSize) -> BoxIter<E> {
self.generator.examples(seed, size)
}
fn shrinker(&self) -> BoxShrink<E> {
self.shrinker.clone()
}
}