Struct icu_capi::fixed_decimal::ffi::FixedDecimal
source · pub struct FixedDecimal(pub FixedDecimal);
Tuple Fields§
§0: FixedDecimal
Implementations§
source§impl FixedDecimal
impl FixedDecimal
sourcepub fn from_int32(v: i32) -> Box<FixedDecimal>
pub fn from_int32(v: i32) -> Box<FixedDecimal>
Construct an FixedDecimal
from an integer.
sourcepub fn from_uint32(v: u32) -> Box<FixedDecimal>
pub fn from_uint32(v: u32) -> Box<FixedDecimal>
Construct an FixedDecimal
from an integer.
sourcepub fn from_int64(v: i64) -> Box<FixedDecimal>
pub fn from_int64(v: i64) -> Box<FixedDecimal>
Construct an FixedDecimal
from an integer.
sourcepub fn from_uint64(v: u64) -> Box<FixedDecimal>
pub fn from_uint64(v: u64) -> Box<FixedDecimal>
Construct an FixedDecimal
from an integer.
sourcepub fn from_double_with_integer_precision(
f: f64,
) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_integer_precision( f: f64, ) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
Construct an FixedDecimal
from an integer-valued float
sourcepub fn from_double_with_lower_magnitude(
f: f64,
magnitude: i16,
) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_lower_magnitude( f: f64, magnitude: i16, ) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
Construct an FixedDecimal
from an float, with a given power of 10 for the lower magnitude
sourcepub fn from_double_with_significant_digits(
f: f64,
digits: u8,
) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_significant_digits( f: f64, digits: u8, ) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
Construct an FixedDecimal
from an float, for a given number of significant digits
sourcepub fn from_double_with_round_trip_precision(
f: f64,
) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_round_trip_precision( f: f64, ) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>
Construct an FixedDecimal
from an float, with enough digits to recover
the original floating point in IEEE 754 without needing trailing zeros
sourcepub fn from_string(
v: &DiplomatStr,
) -> Result<Box<FixedDecimal>, FixedDecimalParseError>
pub fn from_string( v: &DiplomatStr, ) -> Result<Box<FixedDecimal>, FixedDecimalParseError>
Construct an FixedDecimal
from a string.
pub fn digit_at(&self, magnitude: i16) -> u8
pub fn magnitude_start(&self) -> i16
pub fn magnitude_end(&self) -> i16
pub fn nonzero_magnitude_start(&self) -> i16
pub fn nonzero_magnitude_end(&self) -> i16
pub fn is_zero(&self) -> bool
sourcepub fn multiply_pow10(&mut self, power: i16)
pub fn multiply_pow10(&mut self, power: i16)
Multiply the FixedDecimal
by a given power of ten.
pub fn sign(&self) -> FixedDecimalSign
sourcepub fn set_sign(&mut self, sign: FixedDecimalSign)
pub fn set_sign(&mut self, sign: FixedDecimalSign)
Set the sign of the FixedDecimal
.
pub fn apply_sign_display(&mut self, sign_display: FixedDecimalSignDisplay)
pub fn trim_start(&mut self)
pub fn trim_end(&mut self)
sourcepub fn pad_start(&mut self, position: i16)
pub fn pad_start(&mut self, position: i16)
Zero-pad the FixedDecimal
on the left to a particular position
sourcepub fn pad_end(&mut self, position: i16)
pub fn pad_end(&mut self, position: i16)
Zero-pad the FixedDecimal
on the right to a particular position
sourcepub fn set_max_position(&mut self, position: i16)
pub fn set_max_position(&mut self, position: i16)
Truncate the FixedDecimal
on the left to a particular position, deleting digits if necessary. This is useful for, e.g. abbreviating years
(“2022” -> “22”)
sourcepub fn round(&mut self, position: i16)
pub fn round(&mut self, position: i16)
Round the number at a particular digit position.
This uses half to even rounding, which resolves ties by selecting the nearest even integer to the original value.
pub fn ceil(&mut self, position: i16)
pub fn expand(&mut self, position: i16)
pub fn floor(&mut self, position: i16)
pub fn trunc(&mut self, position: i16)
pub fn round_with_mode(&mut self, position: i16, mode: FixedDecimalRoundingMode)
pub fn round_with_mode_and_increment( &mut self, position: i16, mode: FixedDecimalRoundingMode, increment: FixedDecimalRoundingIncrement, )
sourcepub fn concatenate_end(&mut self, other: &mut FixedDecimal) -> Result<(), ()>
pub fn concatenate_end(&mut self, other: &mut FixedDecimal) -> Result<(), ()>
Concatenates other
to the end of self
.
If successful, other
will be set to 0 and a successful status is returned.
If not successful, other
will be unchanged and an error is returned.
sourcepub fn to_string(&self, to: &mut DiplomatWrite)
pub fn to_string(&self, to: &mut DiplomatWrite)
Format the FixedDecimal
as a string.
Auto Trait Implementations§
impl Freeze for FixedDecimal
impl RefUnwindSafe for FixedDecimal
impl Send for FixedDecimal
impl Sync for FixedDecimal
impl Unpin for FixedDecimal
impl UnwindSafe for FixedDecimal
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more