Struct SampledBitSetStrategy
#[must_use = "strategies do nothing unless used"]
pub struct SampledBitSetStrategy<T: BitSetLike> { /* private fields */ }
Generates bit sets with a particular number of bits set.
Specifically, this strategy is given both a size range and a bit range. To produce a new value, it selects a size, then uniformly selects that many bits from within the bit range.
Shrinking happens as with BitSetStrategy.
Implementations
impl<T: BitSetLike> SampledBitSetStrategy<T>
fn new(size: impl Into<SizeRange>, bits: impl Into<SizeRange>) -> SelfCreate a strategy which generates values where bits within the bounds given by
bitsmay be set. The number of bits that are set is chosen to be in the range given bysize.Due to the generics, the functions in the typed submodules are usually preferable to calling this directly.
Panics
Panics if
sizeincludes a value that is greater than the number of bits inbits.
Trait Implementations
impl<T: BitSetLike> Strategy for SampledBitSetStrategy<T>
type Tree = BitSetValueTree<T>;type Value = T;fn new_tree(&self, runner: &mut TestRunner) -> NewTree<Self>
impl<T: Clone + BitSetLike> Clone for SampledBitSetStrategy<T>
fn clone(&self) -> Self
impl<T: Debug + BitSetLike> Debug for SampledBitSetStrategy<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result