Struct icu_capi::fixed_decimal::ffi::SignedFixedDecimal
source · pub struct SignedFixedDecimal(pub SignedFixedDecimal);
Tuple Fields§
§0: SignedFixedDecimal
Implementations§
source§impl SignedFixedDecimal
impl SignedFixedDecimal
sourcepub fn from_int32(v: i32) -> Box<SignedFixedDecimal>
pub fn from_int32(v: i32) -> Box<SignedFixedDecimal>
Construct an SignedFixedDecimal
from an integer.
sourcepub fn from_uint32(v: u32) -> Box<SignedFixedDecimal>
pub fn from_uint32(v: u32) -> Box<SignedFixedDecimal>
Construct an SignedFixedDecimal
from an integer.
sourcepub fn from_int64(v: i64) -> Box<SignedFixedDecimal>
pub fn from_int64(v: i64) -> Box<SignedFixedDecimal>
Construct an SignedFixedDecimal
from an integer.
sourcepub fn from_uint64(v: u64) -> Box<SignedFixedDecimal>
pub fn from_uint64(v: u64) -> Box<SignedFixedDecimal>
Construct an SignedFixedDecimal
from an integer.
sourcepub fn from_double_with_integer_precision(
f: f64,
) -> Result<Box<SignedFixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_integer_precision( f: f64, ) -> Result<Box<SignedFixedDecimal>, FixedDecimalLimitError>
Construct an SignedFixedDecimal
from an integer-valued float
sourcepub fn from_double_with_lower_magnitude(
f: f64,
magnitude: i16,
) -> Result<Box<SignedFixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_lower_magnitude( f: f64, magnitude: i16, ) -> Result<Box<SignedFixedDecimal>, FixedDecimalLimitError>
Construct an SignedFixedDecimal
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<SignedFixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_significant_digits( f: f64, digits: u8, ) -> Result<Box<SignedFixedDecimal>, FixedDecimalLimitError>
Construct an SignedFixedDecimal
from an float, for a given number of significant digits
sourcepub fn from_double_with_round_trip_precision(
f: f64,
) -> Result<Box<SignedFixedDecimal>, FixedDecimalLimitError>
pub fn from_double_with_round_trip_precision( f: f64, ) -> Result<Box<SignedFixedDecimal>, FixedDecimalLimitError>
Construct an SignedFixedDecimal
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<SignedFixedDecimal>, FixedDecimalParseError>
pub fn from_string( v: &DiplomatStr, ) -> Result<Box<SignedFixedDecimal>, FixedDecimalParseError>
Construct an SignedFixedDecimal
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 SignedFixedDecimal
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 SignedFixedDecimal
.
pub fn apply_sign_display(&mut self, sign_display: FixedDecimalSignDisplay)
pub fn trim_start(&mut self)
pub fn trim_end(&mut self)
pub fn trim_end_if_integer(&mut self)
sourcepub fn pad_start(&mut self, position: i16)
pub fn pad_start(&mut self, position: i16)
Zero-pad the SignedFixedDecimal
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 SignedFixedDecimal
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 SignedFixedDecimal
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: FixedDecimalSignedRoundingMode, )
pub fn round_with_mode_and_increment( &mut self, position: i16, mode: FixedDecimalSignedRoundingMode, increment: FixedDecimalRoundingIncrement, )
sourcepub fn concatenate_end(
&mut self,
other: &mut SignedFixedDecimal,
) -> Result<(), ()>
pub fn concatenate_end( &mut self, other: &mut SignedFixedDecimal, ) -> 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 SignedFixedDecimal
as a string.
Auto Trait Implementations§
impl Freeze for SignedFixedDecimal
impl RefUnwindSafe for SignedFixedDecimal
impl Send for SignedFixedDecimal
impl Sync for SignedFixedDecimal
impl Unpin for SignedFixedDecimal
impl UnwindSafe for SignedFixedDecimal
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