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 PartialEq for FixedDecimalError
impl PartialEq for FixedDecimalError
impl Copy for FixedDecimalError
impl StructuralPartialEq for FixedDecimalError
Auto Trait Implementations§
impl Freeze for FixedDecimalError
impl RefUnwindSafe for FixedDecimalError
impl Send for FixedDecimalError
impl Sync for FixedDecimalError
impl Unpin for FixedDecimalError
impl UnwindSafe for FixedDecimalError
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)