#[non_exhaustive]pub enum ParseMoneyError {
MissingCurrency {
text: String,
at: Range<usize>,
},
UnknownCurrency {
text: String,
token: String,
at: Range<usize>,
},
ConflictingCurrencies {
text: String,
first: Range<usize>,
second: Range<usize>,
},
InvalidAmount {
text: String,
at: Range<usize>,
},
}Expand description
An error from reading a monetary amount from text.
Every variant keeps the text the Parser read and points into it by
byte range. The ranges count from the start of that text, leading
whitespace included, so they index it as it was handed in.
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.
MissingCurrency
The text named no currency, and the Parser assumes none.
Fields
UnknownCurrency
The text named a currency that matches no ISO code and no symbol of the currency that applies.
Fields
ConflictingCurrencies
The text named two different currencies.
Fields
InvalidAmount
The digits are missing, malformed, or too large for a Decimal.
Implementations§
Trait Implementations§
Source§impl Clone for ParseMoneyError
impl Clone for ParseMoneyError
Source§fn clone(&self) -> ParseMoneyError
fn clone(&self) -> ParseMoneyError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ParseMoneyError
impl Debug for ParseMoneyError
Source§impl Diagnostic for ParseMoneyError
impl Diagnostic for ParseMoneyError
Source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
Unique diagnostic code that can be used to look up more information
about this
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Additional help text related to this
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Labels to apply to this
Diagnostic’s Diagnostic::source_codeSource§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Source code to apply this
Diagnostic’s Diagnostic::labels to.Source§fn url(&self) -> Option<Box<dyn Display + '_>>
fn url(&self) -> Option<Box<dyn Display + '_>>
URL to visit for a more detailed explanation/help about this
Diagnostic.Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
Diagnostic severity. This may be used by
ReportHandlers to change the display format
of this diagnostic. Read moreAdditional related
Diagnostics.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
The cause of the error.
Source§impl Display for ParseMoneyError
impl Display for ParseMoneyError
impl Eq for ParseMoneyError
Source§impl Error for ParseMoneyError
impl Error for ParseMoneyError
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 PartialEq for ParseMoneyError
impl PartialEq for ParseMoneyError
impl StructuralPartialEq for ParseMoneyError
Auto Trait Implementations§
impl Freeze for ParseMoneyError
impl RefUnwindSafe for ParseMoneyError
impl Send for ParseMoneyError
impl Sync for ParseMoneyError
impl Unpin for ParseMoneyError
impl UnsafeUnpin for ParseMoneyError
impl UnwindSafe for ParseMoneyError
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