pub enum ParseDecimalError {
Empty,
SignOnly,
LeadingZero,
OverlongFractional,
ScientificNotation,
InvalidChar,
OutOfRange,
MissingDigits,
}Expand description
Error returned by <I128<SCALE> as FromStr>::from_str when the input
string is not a valid canonical decimal literal.
Each variant identifies one specific failure mode so callers can surface a precise diagnostic.
§Variants
Empty: the input is empty after trimming.SignOnly: the input is a bare-or+with no digits.LeadingZero: the integer part has a redundant leading zero (e.g.01.5). A bare0or0.xis permitted;00,01, and01.5are not.OverlongFractional: the fractional part has more digits thanSCALE, which would silently discard precision.ScientificNotation: the input contains a scientific-notationeorEexponent. Callers that need this form must strip the exponent themselves.InvalidChar: the input contains a character that is not a digit, sign, or decimal point.OutOfRange: the parsed magnitude exceedsI128::MAXorI128::MINafter scaling by10^SCALE.MissingDigits: a decimal point has no digit on one side (e.g..5or5.). The required form is0.5or5.0.
Variants§
Empty
Input string is empty.
SignOnly
Input is - or + with no following digits.
LeadingZero
Integer part has a redundant leading zero (e.g. 01.5).
OverlongFractional
Fractional part has more digits than SCALE.
ScientificNotation
Input uses scientific notation (1e3); not accepted.
InvalidChar
Input contains a character that is not a digit, sign, or dot.
OutOfRange
Parsed value exceeds I128::MAX or I128::MIN after scaling.
MissingDigits
Decimal point with no digit on one side (e.g. .5 or 5.).
Trait Implementations§
Source§impl Clone for ParseDecimalError
impl Clone for ParseDecimalError
Source§fn clone(&self) -> ParseDecimalError
fn clone(&self) -> ParseDecimalError
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 ParseDecimalError
impl Debug for ParseDecimalError
Source§impl Display for ParseDecimalError
impl Display for ParseDecimalError
Source§impl Error for ParseDecimalError
Available on crate feature std only.
impl Error for ParseDecimalError
Available on crate feature
std only.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 ParseDecimalError
impl Hash for ParseDecimalError
Source§impl PartialEq for ParseDecimalError
impl PartialEq for ParseDecimalError
Source§fn eq(&self, other: &ParseDecimalError) -> bool
fn eq(&self, other: &ParseDecimalError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ParseDecimalError
impl Eq for ParseDecimalError
impl StructuralPartialEq for ParseDecimalError
Auto Trait Implementations§
impl Freeze for ParseDecimalError
impl RefUnwindSafe for ParseDecimalError
impl Send for ParseDecimalError
impl Sync for ParseDecimalError
impl Unpin for ParseDecimalError
impl UnsafeUnpin for ParseDecimalError
impl UnwindSafe for ParseDecimalError
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