Trait rand_distr::weighted::alias_method::Weight [−][src]
pub trait Weight: Copy + SampleUniform + PartialOrd<Self> + Add<Self, Output = Self> + AddAssign<Self> + Sub<Self, Output = Self> + SubAssign<Self> + Mul<Self, Output = Self> + MulAssign<Self> + Div<Self, Output = Self> + DivAssign<Self> + Sum<Self> { pub const MAX: Self; pub const ZERO: Self; pub fn try_from_u32_lossy(n: u32) -> Option<Self>; pub fn sum(values: &[Self]) -> Self { ... } }
Trait that must be implemented for weights, that are used with
WeightedIndex. Currently no guarantees on the correctness of
WeightedIndex are given for custom implementations of this trait.
Associated Constants
pub const MAX: Self[src]
Maximum number representable by Self.
pub const ZERO: Self[src]
Element of Self equivalent to 0.
Required methods
pub fn try_from_u32_lossy(n: u32) -> Option<Self>[src]
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
Loading content...Implementations on Foreign Types
impl Weight for i128[src]
impl Weight for i128[src]impl Weight for isize[src]
impl Weight for isize[src]impl Weight for u64[src]
impl Weight for u64[src]impl Weight for u32[src]
impl Weight for u32[src]impl Weight for usize[src]
impl Weight for usize[src]impl Weight for f32[src]
impl Weight for f32[src]impl Weight for u128[src]
impl Weight for u128[src]impl Weight for u8[src]
impl Weight for u8[src]impl Weight for i8[src]
impl Weight for i8[src]impl Weight for u16[src]
impl Weight for u16[src]impl Weight for i32[src]
impl Weight for i32[src]impl Weight for i16[src]
impl Weight for i16[src]impl Weight for i64[src]
impl Weight for i64[src]impl Weight for f64[src]
impl Weight for f64[src]