Struct icu_capi::fixed_decimal::ffi::FixedDecimal

source ·
pub struct FixedDecimal(pub FixedDecimal);

Tuple Fields§

§0: FixedDecimal

Implementations§

source§

impl FixedDecimal

source

pub fn from_int32(v: i32) -> Box<FixedDecimal>

Construct an FixedDecimal from an integer.

source

pub fn from_uint32(v: u32) -> Box<FixedDecimal>

Construct an FixedDecimal from an integer.

source

pub fn from_int64(v: i64) -> Box<FixedDecimal>

Construct an FixedDecimal from an integer.

source

pub fn from_uint64(v: u64) -> Box<FixedDecimal>

Construct an FixedDecimal from an integer.

source

pub fn from_double_with_integer_precision( f: f64, ) -> Result<Box<FixedDecimal>, FixedDecimalLimitError>

Construct an FixedDecimal from an integer-valued float

source

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

source

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

source

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

source

pub fn from_string( v: &DiplomatStr, ) -> Result<Box<FixedDecimal>, FixedDecimalParseError>

Construct an FixedDecimal from a string.

source

pub fn digit_at(&self, magnitude: i16) -> u8

source

pub fn magnitude_start(&self) -> i16

source

pub fn magnitude_end(&self) -> i16

source

pub fn nonzero_magnitude_start(&self) -> i16

source

pub fn nonzero_magnitude_end(&self) -> i16

source

pub fn is_zero(&self) -> bool

source

pub fn multiply_pow10(&mut self, power: i16)

Multiply the FixedDecimal by a given power of ten.

source

pub fn sign(&self) -> FixedDecimalSign

source

pub fn set_sign(&mut self, sign: FixedDecimalSign)

Set the sign of the FixedDecimal.

source

pub fn apply_sign_display(&mut self, sign_display: FixedDecimalSignDisplay)

source

pub fn trim_start(&mut self)

source

pub fn trim_end(&mut self)

source

pub fn pad_start(&mut self, position: i16)

Zero-pad the FixedDecimal on the left to a particular position

source

pub fn pad_end(&mut self, position: i16)

Zero-pad the FixedDecimal on the right to a particular position

source

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”)

source

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.

source

pub fn ceil(&mut self, position: i16)

source

pub fn expand(&mut self, position: i16)

source

pub fn floor(&mut self, position: i16)

source

pub fn trunc(&mut self, position: i16)

source

pub fn round_with_mode(&mut self, position: i16, mode: FixedDecimalRoundingMode)

source

pub fn round_with_mode_and_increment( &mut self, position: i16, mode: FixedDecimalRoundingMode, increment: FixedDecimalRoundingIncrement, )

source

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.

source

pub fn to_string(&self, to: &mut DiplomatWrite)

Format the FixedDecimal as a string.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T
where T: Send + Sync,