pub struct BitSetStrategy<T>where
T: BitSetLike,{ /* private fields */ }
Expand description
Generates values as a set of bits between the two bounds.
Values are generated by uniformly setting individual bits to 0 or 1 between the bounds. Shrinking iteratively clears bits.
Implementations§
Source§impl<T> BitSetStrategy<T>where
T: BitSetLike,
impl<T> BitSetStrategy<T>where
T: BitSetLike,
Sourcepub fn new(min: usize, max: usize) -> BitSetStrategy<T>
pub fn new(min: usize, max: usize) -> BitSetStrategy<T>
Create a strategy which generates values where bits between min
(inclusive) and max
(exclusive) may be set.
Due to the generics, the functions in the typed submodules are usually preferable to calling this directly.
Sourcepub fn masked(mask: T) -> BitSetStrategy<T>
pub fn masked(mask: T) -> BitSetStrategy<T>
Create a strategy which generates values where any bits set (and only
those bits) in mask
may be set.
Trait Implementations§
Source§impl<T> Clone for BitSetStrategy<T>where
T: Clone + BitSetLike,
impl<T> Clone for BitSetStrategy<T>where
T: Clone + BitSetLike,
Source§fn clone(&self) -> BitSetStrategy<T>
fn clone(&self) -> BitSetStrategy<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Debug for BitSetStrategy<T>where
T: Debug + BitSetLike,
impl<T> Debug for BitSetStrategy<T>where
T: Debug + BitSetLike,
Source§impl<T> Strategy for BitSetStrategy<T>where
T: BitSetLike,
impl<T> Strategy for BitSetStrategy<T>where
T: BitSetLike,
Source§type Tree = BitSetValueTree<T>
type Tree = BitSetValueTree<T>
The value tree generated by this
Strategy
.Source§type Value = T
type Value = T
The type of value used by functions under test generated by this Strategy. Read more
Source§fn new_tree(
&self,
runner: &mut TestRunner,
) -> Result<<BitSetStrategy<T> as Strategy>::Tree, Reason>
fn new_tree( &self, runner: &mut TestRunner, ) -> Result<<BitSetStrategy<T> as Strategy>::Tree, Reason>
Generate a new value tree from the given runner. Read more
Source§fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
Returns a strategy which produces values transformed by the function
fun
. Read moreSource§fn prop_map_into<O>(self) -> MapInto<Self, O>
fn prop_map_into<O>(self) -> MapInto<Self, O>
Source§fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
Returns a strategy which produces values transformed by the function
fun
, which is additionally given a random number generator. Read moreSource§fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
Maps values produced by this strategy into new strategies and picks
values from those strategies. Read more
Source§fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
Maps values produced by this strategy into new strategies and picks
values from those strategies while considering the new strategies to be
independent. Read more
Source§fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
Similar to
prop_ind_flat_map()
, but produces 2-tuples with the input
generated from self
in slot 0 and the derived strategy in slot 1. Read moreSource§fn prop_filter<R, F>(self, whence: R, fun: F) -> Filter<Self, F>
fn prop_filter<R, F>(self, whence: R, fun: F) -> Filter<Self, F>
Returns a strategy which only produces values accepted by
fun
. Read moreSource§fn prop_filter_map<F, O>(
self,
whence: impl Into<Reason>,
fun: F,
) -> FilterMap<Self, F>
fn prop_filter_map<F, O>( self, whence: impl Into<Reason>, fun: F, ) -> FilterMap<Self, F>
Returns a strategy which only produces transformed values where
fun
returns Some(value)
and rejects those where fun
returns None
. Read moreSource§fn prop_union(self, other: Self) -> Union<Self>where
Self: Sized,
fn prop_union(self, other: Self) -> Union<Self>where
Self: Sized,
Source§fn prop_recursive<R, F>(
self,
depth: u32,
desired_size: u32,
expected_branch_size: u32,
recurse: F,
) -> Recursive<Self::Value, F>
fn prop_recursive<R, F>( self, depth: u32, desired_size: u32, expected_branch_size: u32, recurse: F, ) -> Recursive<Self::Value, F>
Generate a recursive structure with
self
items as leaves. Read moreSource§fn prop_shuffle(self) -> Shuffle<Self>
fn prop_shuffle(self) -> Shuffle<Self>
Shuffle the contents of the values produced by this strategy. Read more
Source§fn boxed(self) -> BoxedStrategy<Self::Value>where
Self: Sized + 'static,
fn boxed(self) -> BoxedStrategy<Self::Value>where
Self: Sized + 'static,
Erases the type of this
Strategy
so it can be passed around as a
simple trait object. Read moreimpl<T> Copy for BitSetStrategy<T>where
T: Copy + BitSetLike,
Auto Trait Implementations§
impl<T> Freeze for BitSetStrategy<T>where
T: Freeze,
impl<T> RefUnwindSafe for BitSetStrategy<T>where
T: RefUnwindSafe,
impl<T> Send for BitSetStrategy<T>where
T: Send,
impl<T> Sync for BitSetStrategy<T>where
T: Sync,
impl<T> Unpin for BitSetStrategy<T>where
T: Unpin,
impl<T> UnwindSafe for BitSetStrategy<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more