Struct UniformUsize

struct UniformUsize { ... }

The back-end implementing UniformSampler for usize.

Implementation notes

Sampling a usize value is usually used in relation to the length of an array or other memory structure, thus it is reasonable to assume that the vast majority of use-cases will have a maximum size under u32::MAX. In part to optimise for this use-case, but mostly to ensure that results are portable across 32-bit and 64-bit architectures (as far as is possible), this implementation will use 32-bit sampling when possible.

Implementations

impl Clone for UniformUsize

fn clone(self: &Self) -> UniformUsize

impl Copy for UniformUsize

impl Debug for UniformUsize

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

impl Eq for UniformUsize

impl Freeze for UniformUsize

impl PartialEq for UniformUsize

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

impl RefUnwindSafe for UniformUsize

impl Send for UniformUsize

impl StructuralPartialEq for UniformUsize

impl Sync for UniformUsize

impl UniformSampler for UniformUsize

fn new<B1, B2>(low_b: B1, high_b: B2) -> Result<Self, Error>
where
    B1: SampleBorrow<<Self as >::X> + Sized,
    B2: SampleBorrow<<Self as >::X> + Sized
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Result<Self, Error>
where
    B1: SampleBorrow<<Self as >::X> + Sized,
    B2: SampleBorrow<<Self as >::X> + Sized
fn sample<R: Rng + ?Sized>(self: &Self, rng: &mut R) -> usize
fn sample_single<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R) -> Result<<Self as >::X, Error>
where
    B1: SampleBorrow<<Self as >::X> + Sized,
    B2: SampleBorrow<<Self as >::X> + Sized
fn sample_single_inclusive<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R) -> Result<<Self as >::X, Error>
where
    B1: SampleBorrow<<Self as >::X> + Sized,
    B2: SampleBorrow<<Self as >::X> + Sized

impl Unpin for UniformUsize

impl UnsafeUnpin for UniformUsize

impl UnwindSafe for UniformUsize

impl<T> Any for UniformUsize

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for UniformUsize

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

impl<T> BorrowMut for UniformUsize

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

impl<T> CloneToUninit for UniformUsize

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

impl<T> From for UniformUsize

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for UniformUsize

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

impl<T, U> Into for UniformUsize

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 UniformUsize

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

impl<T, U> TryInto for UniformUsize

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

impl<V, T> VZip for UniformUsize

fn vzip(self: Self) -> V