pub enum CrateError {
NonDigitChar(char),
NonDigitNumber(u128),
NegativeNumber(i128),
Overflow,
}
Expand description
Custom error scenarios related to this crate.
Variants§
NonDigitChar(char)
When a character does not represent a 0-9 digit.
NonDigitNumber(u128)
When a number does not represent a 0-9 digit.
NegativeNumber(i128)
When trying to convert a negative number.
Overflow
When an operation causes a numeric overflow.
Trait Implementations§
Source§impl Clone for CrateError
impl Clone for CrateError
Source§fn clone(&self) -> CrateError
fn clone(&self) -> CrateError
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CrateError
impl Debug for CrateError
Source§impl Display for CrateError
CrateError has a string representation.
impl Display for CrateError
CrateError has a string representation.
use digit_sequence::*;
assert_eq!(CrateError::NonDigitNumber(90).to_string(), "Non-digit number: 90");
assert_eq!(CrateError::NonDigitChar('X').to_string(), "Non-digit char: X");
assert_eq!(CrateError::NegativeNumber(-90).to_string(), "Cannot convert negative number: -90");
assert_eq!(CrateError::Overflow.to_string(), "Overflow");
Source§impl Error for CrateError
impl Error for CrateError
1.30.0 · 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 Hash for CrateError
impl Hash for CrateError
Source§impl Ord for CrateError
impl Ord for CrateError
Source§fn cmp(&self, other: &CrateError) -> Ordering
fn cmp(&self, other: &CrateError) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for CrateError
impl PartialEq for CrateError
Source§impl PartialOrd for CrateError
impl PartialOrd for CrateError
impl Copy for CrateError
impl Eq for CrateError
impl StructuralPartialEq for CrateError
Auto Trait Implementations§
impl Freeze for CrateError
impl RefUnwindSafe for CrateError
impl Send for CrateError
impl Sync for CrateError
impl Unpin for CrateError
impl UnwindSafe for CrateError
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