Struct SizeRange

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

A value like 0..=std::usize::MAX will still be accepted but will silently truncate the maximum to std::usize::MAX - 1.

The Default is 0..PROPTEST_MAX_DEFAULT_SIZE_RANGE. The max can be set with the PROPTEST_MAX_DEFAULT_SIZE_RANGE env var, which defaults to 100.

Implementations

impl SizeRange

fn new(range: RangeInclusive<usize>) -> Self

Creates a SizeBounds from a RangeInclusive<usize>.

fn with<X>(self: Self, and: X) -> (Self, X)

Merges self together with some other argument producing a product type expected by some implementations of A: Arbitrary in A::Parameters. This can be more ergonomic to work with and may help type inference.

fn lift<X: Default>(self: Self) -> (Self, X)

Merges self together with some other argument generated with a default value producing a product type expected by some implementations of A: Arbitrary in A::Parameters. This can be more ergonomic to work with and may help type inference.

fn start(self: &Self) -> usize

The lower bound of the range (inclusive).

fn start_end_incl(self: &Self) -> (usize, usize)

Extract the ends [low, high] of a SizeRange.

fn end_incl(self: &Self) -> usize

The upper bound of the range (inclusive).

fn end_excl(self: &Self) -> usize

The upper bound of the range (exclusive).

impl Add for SizeRange

fn add(self: Self, rhs: usize) -> <Self as >::Output

impl Arbitrary for SizeRange

fn arbitrary_with(_args: <Self as >::Parameters) -> <Self as >::Strategy

impl Clone for SizeRange

fn clone(self: &Self) -> SizeRange

impl Debug for SizeRange

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

impl Default for SizeRange

fn default() -> Self

Constructs a SizeRange equivalent to size_range(0..PROPTEST_MAX_DEFAULT_SIZE_RANGE). The max can be set with the PROPTEST_MAX_DEFAULT_SIZE_RANGE env var, which defaults to 100.

impl Eq for SizeRange

impl Freeze for SizeRange

impl From for SizeRange

fn from(r: Range<usize>) -> Self

impl From for SizeRange

fn from(r: RangeInclusive<usize>) -> Self

impl From for SizeRange

fn from((low, high): (usize, usize)) -> Self

impl From for SizeRange

fn from(high: RangeToInclusive<usize>) -> Self

impl From for SizeRange

fn from(exact: usize) -> Self

impl From for SizeRange

fn from(high: RangeTo<usize>) -> Self

impl Hash for SizeRange

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl PartialEq for SizeRange

fn eq(self: &Self, other: &SizeRange) -> bool

impl RefUnwindSafe for SizeRange

impl Send for SizeRange

impl StructuralPartialEq for SizeRange

impl Sync for SizeRange

impl Unpin for SizeRange

impl UnwindSafe for SizeRange

impl<T> Any for SizeRange

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for SizeRange

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

impl<T> BorrowMut for SizeRange

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

impl<T> CloneToUninit for SizeRange

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

impl<T> From for SizeRange

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for SizeRange

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

impl<T, U> Into for SizeRange

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 SizeRange

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

impl<T, U> TryInto for SizeRange

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

impl<V, T> VZip for SizeRange

fn vzip(self: Self) -> V