Struct SampledBitSetStrategy

struct SampledBitSetStrategy<T: BitSetLike> { ... }

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<impl Into<SizeRange>: Into<SizeRange>, impl Into<SizeRange>: Into<SizeRange>>(size: impl Into<SizeRange>, bits: impl Into<SizeRange>) -> Self

Create a strategy which generates values where bits within the bounds given by bits may be set. The number of bits that are set is chosen to be in the range given by size.

Due to the generics, the functions in the typed submodules are usually preferable to calling this directly.

Panics

Panics if size includes a value that is greater than the number of bits in bits.

impl<T> Any for SampledBitSetStrategy<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for SampledBitSetStrategy<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for SampledBitSetStrategy<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for SampledBitSetStrategy<T>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> Freeze for SampledBitSetStrategy<T>

impl<T> From for SampledBitSetStrategy<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for SampledBitSetStrategy<T>

impl<T> Send for SampledBitSetStrategy<T>

impl<T> Sync for SampledBitSetStrategy<T>

impl<T> ToOwned for SampledBitSetStrategy<T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> Unpin for SampledBitSetStrategy<T>

impl<T> UnwindSafe for SampledBitSetStrategy<T>

impl<T, U> Into for SampledBitSetStrategy<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for SampledBitSetStrategy<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for SampledBitSetStrategy<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::clone::Clone + BitSetLike> Clone for SampledBitSetStrategy<T>

fn clone(self: &Self) -> SampledBitSetStrategy<T>

impl<T: $crate::fmt::Debug + BitSetLike> Debug for SampledBitSetStrategy<T>

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl<T: BitSetLike> Strategy for SampledBitSetStrategy<T>

fn new_tree(self: &Self, runner: &mut TestRunner) -> NewTree<Self>

impl<V, T> VZip for SampledBitSetStrategy<T>

fn vzip(self: Self) -> V