#[non_exhaustive]pub enum Error {
InvalidInput,
InvalidWeight,
InsufficientNonZero,
Overflow,
}
alloc
only.Expand description
Invalid weight errors
This type represents errors from WeightedIndex::new
,
WeightedIndex::update_weights
and other weighted distributions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidInput
The input weight sequence is empty, too long, or wrongly ordered
InvalidWeight
A weight is negative, too large for the distribution, or not a valid number
InsufficientNonZero
Not enough non-zero weights are available to sample values
When attempting to sample a single value this implies that all weights
are zero. When attempting to sample amount
values this implies that
less than amount
weights are greater than zero.
Overflow
Overflow when calculating the sum of weights
Trait Implementations§
Source§impl Error for Error
Available on crate feature std
only.
impl Error for Error
std
only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
impl Copy for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
InvalidInput
: 0 bytesInvalidWeight
: 0 bytesInsufficientNonZero
: 0 bytesOverflow
: 0 bytes