Struct dec::Decimal32

source ·
pub struct Decimal32 { /* private fields */ }
Expand description

A 32-bit decimal floating-point number.

Implementations§

source§

impl Decimal32

source

pub const NAN: Decimal32 = _

The value that represents Not-a-Number (NaN).

source

pub const ZERO: Decimal32 = _

The value that represents zero.

source

pub const ONE: Decimal32 = _

The value that represents one.

source

pub fn from_le_bytes(bytes: [u8; 4]) -> Decimal32

Creates a number from its representation as a little-endian byte array.

source

pub fn from_be_bytes(bytes: [u8; 4]) -> Decimal32

Creates a number from its representation as a big-endian byte array.

source

pub const fn from_ne_bytes(bytes: [u8; 4]) -> Decimal32

Creates a number from its representation as a byte array in the native endianness of the target platform.

source

pub fn to_le_bytes(&self) -> [u8; 4]

Returns the memory representation of the number as a byte array in little-endian order.

source

pub fn to_be_bytes(&self) -> [u8; 4]

Returns the memory representation of the number as a byte array in big-endian order.

source

pub fn to_ne_bytes(&self) -> [u8; 4]

Returns the memory representation of the number as a byte array in the native endianness of the target platform.

source

pub fn coefficient(&self) -> i32

Computes the coefficient of the number.

If the number is a special value (i.e., NaN or infinity), returns zero.

source

pub fn exponent(&self) -> i32

Computes the exponent of the number.

Trait Implementations§

source§

impl Clone for Decimal32

source§

fn clone(&self) -> Decimal32

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Decimal32

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Decimal32

source§

fn default() -> Decimal32

Returns the “default value” for a type. Read more
source§

impl Display for Decimal32

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const N: usize> From<Decimal32> for Decimal<N>

source§

fn from(n: Decimal32) -> Decimal<N>

Converts to this type from the input type.
source§

impl From<Decimal32> for Decimal128

source§

fn from(d32: Decimal32) -> Decimal128

Converts to this type from the input type.
source§

impl From<Decimal32> for Decimal64

source§

fn from(d32: Decimal32) -> Decimal64

Converts to this type from the input type.
source§

impl<D> From<Decimal32> for OrderedDecimal<D>
where D: From<Decimal32>,

source§

fn from(n: Decimal32) -> OrderedDecimal<D>

Converts to this type from the input type.
source§

impl FromStr for Decimal32

§

type Err = ParseDecimalError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Decimal32, ParseDecimalError>

Parses a string s to return a value of this type. Read more
source§

impl Copy for Decimal32

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.