pub struct Fixed { /* private fields */ }Expand description
The value of an IDL fixed<digits, scale>: a decimal number with a
sign, its digits and the number of them after the decimal point.
The value is kept as it was made, and fitted to the digits and scale of
a fixed type when it is sent: digits after the scale are cut off,
and an integer part that does not fit is DATA_CONVERSION. Values
compare by their number, so 1.50 equals 1.5. Arithmetic is not
provided.
Implementations§
Source§impl Fixed
impl Fixed
Sourcepub fn from_digits(digits: &[u8], scale: u16, negative: bool) -> Option<Fixed>
pub fn from_digits(digits: &[u8], scale: u16, negative: bool) -> Option<Fixed>
The value with the digits digits (each 0 to 9, most significant
first), scale of them after the decimal point. None if a digit
is over 9 or there are fewer digits than scale.
Sourcepub fn digits(&self) -> &[u8] ⓘ
pub fn digits(&self) -> &[u8] ⓘ
The digits, most significant first, without leading zeros in the integer part.
Sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Whether the value is below zero.
Sourcepub fn truncate(&self, scale: u16) -> Fixed
pub fn truncate(&self, scale: u16) -> Fixed
The value with at most scale digits after the decimal point, the
others cut off.