Struct proptest::collection::SizeRange [−][src]
pub struct SizeRange(_);
The minimum and maximum range/bounds on the size of a collection.
The interval must form a subset of [0, std::usize::MAX]
.
The Default
is 0..100
.
Methods
impl SizeRange
[src]
impl SizeRange
pub fn new(range: RangeInclusive<usize>) -> Self
[src]
pub fn new(range: RangeInclusive<usize>) -> Self
Creates a SizeBounds
from a RangeInclusive<usize>
.
pub fn with<X>(self, and: X) -> (Self, X)
[src]
pub fn with<X>(self, and: X) -> (Self, X)
Merges self together with some other argument producing a product
type expected by some impelementations of A: Arbitrary
in
A::Parameters
. This can be more ergonomic to work with and may
help type inference.
pub fn lift<X: Default>(self) -> (Self, X)
[src]
pub fn lift<X: Default>(self) -> (Self, X)
Merges self together with some other argument generated with a
default value producing a product type expected by some
impelementations of A: Arbitrary
in A::Parameters
.
This can be more ergonomic to work with and may help type inference.
Trait Implementations
impl Arbitrary for SizeRange
[src]
impl Arbitrary for SizeRange
type Parameters = ()
The type of parameters that [arbitrary_with
] accepts for configuration of the generated [Strategy
]. Parameters must implement [Default
]. Read more
type Strategy = MapInto<StrategyFor<RangeInclusive<usize>>, Self>
The type of [Strategy
] used to generate values of type Self
. Read more
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
[src]
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
Generates a [Strategy
] for producing arbitrary values of type the implementing type (Self
). The strategy is passed the arguments given in args. Read more
fn arbitrary() -> Self::Strategy
[src]
fn arbitrary() -> Self::Strategy
Generates a [Strategy
] for producing arbitrary values of type the implementing type (Self
). Read more
impl Default for SizeRange
[src]
impl Default for SizeRange
impl From<(usize, usize)> for SizeRange
[src]
impl From<(usize, usize)> for SizeRange
Given (low: usize, high: usize)
,
then a size range of [low..high)
is the result.
impl From<usize> for SizeRange
[src]
impl From<usize> for SizeRange
Given exact
, then a size range of [exact, exact]
is the result.
impl From<RangeTo<usize>> for SizeRange
[src]
impl From<RangeTo<usize>> for SizeRange
Given ..high
, then a size range [0, high)
is the result.
impl From<Range<usize>> for SizeRange
[src]
impl From<Range<usize>> for SizeRange
Given low .. high
, then a size range [low, high)
is the result.
impl From<RangeInclusive<usize>> for SizeRange
[src]
impl From<RangeInclusive<usize>> for SizeRange
Given low ..= high
, then a size range [low, high]
is the result.
fn from(r: RangeInclusive<usize>) -> Self
[src]
fn from(r: RangeInclusive<usize>) -> Self
Performs the conversion.
impl From<RangeToInclusive<usize>> for SizeRange
[src]
impl From<RangeToInclusive<usize>> for SizeRange
Given ..=high
, then a size range [0, high]
is the result.
fn from(high: RangeToInclusive<usize>) -> Self
[src]
fn from(high: RangeToInclusive<usize>) -> Self
Performs the conversion.
impl From<SizeRange> for Range<usize>
[src]
impl From<SizeRange> for Range<usize>
Given a size range [low, high]
, then a rangelow..(high + 1)
is returned.
This will panic if high == usize::MAX
.
impl From<SizeRange> for RangeInclusive<usize>
[src]
impl From<SizeRange> for RangeInclusive<usize>
Given a size range [low, high]
, then a range low..=high
is returned.
impl Add<usize> for SizeRange
[src]
impl Add<usize> for SizeRange
Adds usize
to both start and end of the bounds.
Panics if adding to either end overflows usize
.
type Output = SizeRange
The resulting type after applying the +
operator.
fn add(self, rhs: usize) -> Self::Output
[src]
fn add(self, rhs: usize) -> Self::Output
Performs the +
operation.
impl Clone for SizeRange
[src]
impl Clone for SizeRange
fn clone(&self) -> SizeRange
[src]
fn clone(&self) -> SizeRange
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for SizeRange
[src]
impl PartialEq for SizeRange
fn eq(&self, other: &SizeRange) -> bool
[src]
fn eq(&self, other: &SizeRange) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &SizeRange) -> bool
[src]
fn ne(&self, other: &SizeRange) -> bool
This method tests for !=
.
impl Eq for SizeRange
[src]
impl Eq for SizeRange
impl Hash for SizeRange
[src]
impl Hash for SizeRange
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for SizeRange
[src]
impl Debug for SizeRange