#[non_exhaustive]pub enum DFRngError {
RngError(RngError),
}
Expand description
Errors that can occur in DFRNG operations.
This enum represents the various errors that can occur when using the DFRNG library. It wraps errors from the random number generation module.
§Examples
use darkforge_rng::rng::{UniformThreadRandom, RngError};
use darkforge_rng::DFRngError;
// This will fail because high < low
let err = UniformThreadRandom::<u8>::new(100, 1).expect_err("should have failed");
match err {
DFRngError::RngError(e) => {
// Handle the RNG error
match e {
RngError::InvalidDistribution(_) => {
println!("Invalid distribution parameters");
}
}
}
_ => panic!("unexpected error type")
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
RngError(RngError)
An error occurred in the random number generation.
This wraps errors from the rng
module, such as invalid distribution parameters.
See rng::RngError
for more details on specific error types.
Trait Implementations§
Source§impl Debug for DFRngError
impl Debug for DFRngError
Source§impl Display for DFRngError
impl Display for DFRngError
Source§impl Error for DFRngError
impl Error for DFRngError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<RngError> for DFRngError
impl From<RngError> for DFRngError
Source§impl PartialEq for DFRngError
impl PartialEq for DFRngError
impl StructuralPartialEq for DFRngError
Auto Trait Implementations§
impl Freeze for DFRngError
impl RefUnwindSafe for DFRngError
impl Send for DFRngError
impl Sync for DFRngError
impl Unpin for DFRngError
impl UnwindSafe for DFRngError
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
Mutably borrows from an owned value. Read more