pub trait AliasableWeight:
Sized
+ Copy
+ SampleUniform
+ PartialOrd
+ Add<Output = Self>
+ AddAssign
+ Sub<Output = Self>
+ SubAssign
+ Mul<Output = Self>
+ MulAssign
+ Div<Output = Self>
+ DivAssign
+ Sum {
const MAX: Self;
const ZERO: Self;
// Required method
fn try_from_u32_lossy(n: u32) -> Option<Self>;
// Provided method
fn sum(values: &[Self]) -> Self { ... }
}
Expand description
Weight bound for WeightedAliasIndex
Currently no guarantees on the correctness of WeightedAliasIndex
are
given for custom implementations of this trait.
Required Associated Constants§
Required Methods§
Sourcefn try_from_u32_lossy(n: u32) -> Option<Self>
fn try_from_u32_lossy(n: u32) -> Option<Self>
Produce an instance of Self
from a u32
value, or return None
if
out of range. Loss of precision (where Self
is a floating point type)
is acceptable.
Provided Methods§
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.