Struct UniformUsize
pub struct UniformUsize { /* private fields */ }
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.
Trait Implementations
impl Clone for UniformUsize
fn clone(&self) -> Self
impl Copy for UniformUsize
impl Debug for UniformUsize
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for UniformUsize
impl PartialEq for UniformUsize
fn eq(&self, other: &Self) -> bool
impl Serialize for UniformUsize
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer,
impl StructuralPartialEq for UniformUsize
impl UniformSampler for UniformUsize
type X = usize;fn new<B1, B2>(low_b: B1, high_b: B2) -> Result<Self, Error> where B1: SampleBorrow<Self::X> + Sized, B2: SampleBorrow<Self::X> + Sized,fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Result<Self, Error> where B1: SampleBorrow<Self::X> + Sized, B2: SampleBorrow<Self::X> + Sized,fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> usizefn sample_single<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R) -> Result<Self::X, Error> where B1: SampleBorrow<Self::X> + Sized, B2: SampleBorrow<Self::X> + Sized,fn sample_single_inclusive<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R) -> Result<Self::X, Error> where B1: SampleBorrow<Self::X> + Sized, B2: SampleBorrow<Self::X> + Sized,
impl<'de> Deserialize<'de> for UniformUsize
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where __D: Deserializer<'de>,