Skip to main content

zip

Function zip 

Source
pub fn zip<E0, E1>(
    shrink0: BoxShrink<E0>,
    shrink1: BoxShrink<E1>,
) -> BoxShrink<(E0, E1)>
where E0: Clone + 'static, E1: Clone + 'static,
Expand description

Combine two shrinkers together element wise into shrinker of tuples.

use monkey_test::*;

let alfa1: BoxShrink<u8> = shrinks::int_to_zero::<u8>();
let beta1: BoxShrink<i64> = shrinks::int_to_zero::<i64>();

let alfa2: BoxShrink<u8> = shrinks::int_to_zero::<u8>();
let beta2: BoxShrink<i64> = shrinks::int_to_zero::<i64>();

// Zip two shrinkers to a tuple shrinker.
let tuples1: BoxShrink<(u8, i64)> = shrinks::zip(alfa1, beta1);

// Shorthand way to do the same thing.
let tuples2: BoxShrink<(u8, i64)> = alfa2.zip(beta2);