pub trait UniformSampler: Sized {
type X;
// Required methods
fn new<B1, B2>(low: B1, high: B2) -> Result<Self, UniformDistributionError>
where B1: SampleBorrow<Self::X> + Sized,
B2: SampleBorrow<Self::X> + Sized;
fn new_inclusive<B1, B2>(
low: B1,
high: B2,
) -> Result<Self, UniformDistributionError>
where B1: SampleBorrow<Self::X> + Sized,
B2: SampleBorrow<Self::X> + Sized;
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X;
// Provided methods
fn sample_single<R: Rng + ?Sized, B1, B2>(
low: B1,
high: B2,
rng: &mut R,
) -> Result<Self::X, UniformDistributionError>
where B1: SampleBorrow<Self::X> + Sized,
B2: SampleBorrow<Self::X> + Sized { ... }
fn sample_single_inclusive<R: Rng + ?Sized, B1, B2>(
low: B1,
high: B2,
rng: &mut R,
) -> Result<Self::X, UniformDistributionError>
where B1: SampleBorrow<Self::X> + Sized,
B2: SampleBorrow<Self::X> + Sized { ... }
}Required Associated Types§
Required Methods§
fn new<B1, B2>(low: B1, high: B2) -> Result<Self, UniformDistributionError>
fn new_inclusive<B1, B2>( low: B1, high: B2, ) -> Result<Self, UniformDistributionError>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X
Provided Methods§
fn sample_single<R: Rng + ?Sized, B1, B2>( low: B1, high: B2, rng: &mut R, ) -> Result<Self::X, UniformDistributionError>
fn sample_single_inclusive<R: Rng + ?Sized, B1, B2>( low: B1, high: B2, rng: &mut R, ) -> Result<Self::X, UniformDistributionError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.