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>) -> 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.

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) -> SampledBitSetStrategy<T>

impl<T: Debug + BitSetLike> Debug for SampledBitSetStrategy<T>

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

Auto Trait Implementations

impl<T> Freeze for SampledBitSetStrategy<T> where PhantomData<T>: Freeze,

impl<T> RefUnwindSafe for SampledBitSetStrategy<T> where PhantomData<T>: RefUnwindSafe,

impl<T> Send for SampledBitSetStrategy<T> where PhantomData<T>: Send,

impl<T> Sync for SampledBitSetStrategy<T> where PhantomData<T>: Sync,

impl<T> Unpin for SampledBitSetStrategy<T> where PhantomData<T>: Unpin,

impl<T> UnsafeUnpin for SampledBitSetStrategy<T> where PhantomData<T>: UnsafeUnpin,

impl<T> UnwindSafe for SampledBitSetStrategy<T> where PhantomData<T>: UnwindSafe,

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for SampledBitSetStrategy<T> where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for SampledBitSetStrategy<T> where ST: ?Sized, DT: ?Sized,

impl<T> Any for SampledBitSetStrategy<T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for SampledBitSetStrategy<T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for SampledBitSetStrategy<T> where T: ?Sized,

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

impl<T> CloneToUninit for SampledBitSetStrategy<T> where T: Clone,

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

impl<T> From<T> for SampledBitSetStrategy<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Read<Exclusive, BecauseExclusive> for SampledBitSetStrategy<T> where T: ?Sized,

impl<T> ToOwned for SampledBitSetStrategy<T> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for SampledBitSetStrategy<T> where U: From<T>,

fn into(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<U> for SampledBitSetStrategy<T> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for SampledBitSetStrategy<T> where U: TryFrom<T>,

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

impl<V, T> VZip<V> for SampledBitSetStrategy<T> where V: MultiLane<T>,

fn vzip(self) -> V