pub enum Num2Err {
CannotConvert,
NegativeOrdinal,
FloatingOrdinal,
FloatingYear,
InfiniteOrdinal,
InfiniteYear,
}Expand description
Error type returned by the builder
Variants§
CannotConvert
General error, language cannot convert number
It is likely that the language does not support the number because it is too large.
Example:
use num2words::{Num2Err, Num2Words};
assert_eq!(
Num2Words::new(1e100).to_words(),
Err(Num2Err::CannotConvert)
);NegativeOrdinal
Request of a negative ordinal
Example:
use num2words::{Num2Err, Num2Words};
assert_eq!(
Num2Words::new(-42).ordinal().to_words(),
Err(Num2Err::NegativeOrdinal)
);FloatingOrdinal
Request of a float ordinal
Example:
use num2words::{Num2Err, Num2Words};
assert_eq!(
Num2Words::new(42.01).ordinal().to_words(),
Err(Num2Err::FloatingOrdinal)
);FloatingYear
Request of a float year
Example:
use num2words::{Num2Err, Num2Words};
assert_eq!(
Num2Words::new(42.01).year().to_words(),
Err(Num2Err::FloatingYear)
);InfiniteOrdinal
Request of an infinite ordinal
Example:
use num2words::{Num2Err, Num2Words};
assert_eq!(
Num2Words::parse("inf").unwrap().ordinal().to_words(),
Err(Num2Err::InfiniteOrdinal)
);InfiniteYear
Request of an infinite year
Example:
use num2words::{Num2Err, Num2Words};
assert_eq!(
Num2Words::parse("inf").unwrap().year().to_words(),
Err(Num2Err::InfiniteYear)
);Trait Implementations§
impl StructuralPartialEq for Num2Err
Auto Trait Implementations§
impl Freeze for Num2Err
impl RefUnwindSafe for Num2Err
impl Send for Num2Err
impl Sync for Num2Err
impl Unpin for Num2Err
impl UnwindSafe for Num2Err
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