Struct proptest::bits::SampledBitSetStrategy[][src]

#[must_use = "strategies do nothing unless used"]pub struct SampledBitSetStrategy<T: BitSetLike> { /* fields omitted */ }

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>[src]

pub fn new(size: impl Into<SizeRange>, bits: impl Into<SizeRange>) -> Self[src]

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: Clone + BitSetLike> Clone for SampledBitSetStrategy<T>[src]

impl<T: Debug + BitSetLike> Debug for SampledBitSetStrategy<T>[src]

impl<T: BitSetLike> Strategy for SampledBitSetStrategy<T>[src]

type Tree = BitSetValueTree<T>

The value tree generated by this Strategy.

type Value = T

The type of value used by functions under test generated by this Strategy. Read more

Auto Trait Implementations

impl<T> Send for SampledBitSetStrategy<T> where
    T: Send
[src]

impl<T> Sync for SampledBitSetStrategy<T> where
    T: Sync
[src]

impl<T> Unpin for SampledBitSetStrategy<T> where
    T: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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