Enum fixed_decimal::FixedDecimalError
source · #[non_exhaustive]pub enum FixedDecimalError {
Limit,
Syntax,
}
Expand description
An error involving FixedDecimal operations or conversion.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Limit
The magnitude or number of digits exceeds the limit of the FixedDecimal
. The highest
magnitude of the most significant digit is i16::MAX
, and the lowest magnitude of the
least significant digit is i16::MIN
.
This error is also returned when constructing a FixedInteger
from a FixedDecimal
with a
fractional part.
§Examples
use fixed_decimal::Error;
use fixed_decimal::FixedDecimal;
let mut dec1 = FixedDecimal::from(123);
dec1.multiply_pow10(i16::MAX);
assert!(dec1.is_zero());
Syntax
The input of a string that is supposed to be converted to FixedDecimal is not accepted.
Any string with non-digit characters (except for one ‘.’ and one ‘-’ at the beginning of the string) is not accepted. Also, empty string (“”) and its negation (“-”) are not accepted. Strings of form “12_345_678” are not accepted, the accepted format is “12345678”. Also ‘.’ shouldn’t be first or the last characters, i. e. .123 and 123. are not accepted, and instead 0.123 and 123 (or 123.0) must be used.
Trait Implementations§
source§impl Clone for FixedDecimalError
impl Clone for FixedDecimalError
source§fn clone(&self) -> FixedDecimalError
fn clone(&self) -> FixedDecimalError
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FixedDecimalError
impl Debug for FixedDecimalError
source§impl Display for FixedDecimalError
impl Display for FixedDecimalError
source§impl Error for Error
impl Error for Error
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl PartialEq for FixedDecimalError
impl PartialEq for FixedDecimalError
source§fn eq(&self, other: &FixedDecimalError) -> bool
fn eq(&self, other: &FixedDecimalError) -> bool
self
and other
values to be equal, and is used
by ==
.