Struct SizeRange

pub struct SizeRange(/* private field */);

The minimum and maximum range/bounds on the size of a collection. The interval must form a subset of [0, usize::MAX).

A value like 0..=usize::MAX will still be accepted but will silently truncate the maximum to 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, 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, 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) -> usize

The lower bound of the range (inclusive).

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

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

fn end_incl(&self) -> usize

The upper bound of the range (inclusive).

fn end_excl(&self) -> usize

The upper bound of the range (exclusive).

Trait Implementations

impl Add<usize> for SizeRange

type Output = SizeRange;
fn add(self, rhs: usize) -> Self::Output

impl Arbitrary for SizeRange

type Parameters = ();
type Strategy = MapInto<<RangeInclusive<usize> as Arbitrary>::Strategy, SizeRange>;
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy

impl Clone for SizeRange

fn clone(&self) -> SizeRange

impl Debug for SizeRange

fn fmt(&self, f: &mut Formatter<'_>) -> 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 From<(usize, usize)> for SizeRange

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

impl From<Range<usize>> for SizeRange

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

impl From<RangeInclusive<usize>> for SizeRange

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

impl From<RangeTo<usize>> for SizeRange

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

impl From<RangeToInclusive<usize>> for SizeRange

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

impl From<usize> for SizeRange

fn from(exact: usize) -> Self

impl Hash for SizeRange

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

impl PartialEq for SizeRange

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

impl StructuralPartialEq for SizeRange

Auto Trait Implementations

impl Freeze for SizeRange

impl RefUnwindSafe for SizeRange

impl Send for SizeRange

impl Sync for SizeRange

impl Unpin for SizeRange

impl UnsafeUnpin for SizeRange

impl UnwindSafe for SizeRange

Blanket Implementations

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

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for SizeRange

fn from(t: T) -> T

Returns the argument unchanged.

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

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

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

impl<T, U> Into<U> for SizeRange 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 SizeRange where U: Into<T>,

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

impl<T, U> TryInto<U> for SizeRange 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 SizeRange where V: MultiLane<T>,

fn vzip(self) -> V