Struct decstr::BigBitstring

source ·
pub struct BigBitstring(_);
Expand description

An arbitrary precision decimal number.

This type is only available when the arbitrary-precision feature is enabled.

Implementations§

source§

impl BigBitstring

source

pub fn try_from_le_bytes(bytes: &[u8]) -> Result<Self, Error>

Try create a decimal from the given buffer.

The buffer is assumed to be in little-endian byte-order already. This method will fail if the buffer length is not a multiple of 4 bytes.

source

pub fn as_le_bytes(&self) -> &[u8]

Get a reference to the underlying bitstring buffer.

This buffer is always stored in little-endian byte-order, regardless of the endianness of the platform.

source

pub fn zero() -> Self

Create a decimal with the finite value zero.

source§

impl BigBitstring

source

pub fn is_sign_negative(&self) -> bool

Whether or not the sign bit is set.

source

pub fn is_finite(&self) -> bool

Whether or not the decimal is a finite number.

source

pub fn is_infinite(&self) -> bool

Whether or not the decimal is an infinity.

source

pub fn is_nan(&self) -> bool

Whether the decimal is not a NaN.

source

pub fn is_quiet_nan(&self) -> bool

Whether the decimal is a qNaN.

source

pub fn is_signaling_nan(&self) -> bool

Whether the decimal is a sNaN.

source§

impl BigBitstring

source

pub fn try_parse_str(s: &str) -> Result<BigBitstring, Error>

Try parse a decimal from a string.

This method is more efficient than try_parse if you already have a string to parse.

source

pub fn try_parse(n: impl Display) -> Result<BigBitstring, Error>

Try parse a decimal from some formattable value.

This method can avoid needing to buffer an entire number upfront.

source§

impl BigBitstring

source

pub fn from_f32(f: f32) -> BigBitstring

Convert a binary floating point into a decimal.

source§

impl BigBitstring

source

pub fn from_f64(f: f64) -> BigBitstring

Convert a binary floating point into a decimal.

source§

impl BigBitstring

source

pub fn to_f32(&self) -> Option<f32>

Try convert a decimal into a binary floating point.

source§

impl BigBitstring

source

pub fn to_f64(&self) -> Option<f64>

Try convert a decimal into a binary floating point.

source§

impl BigBitstring

source

pub fn from_i8(i: i8) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_i16(i: i16) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_i32(i: i32) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_i64(i: i64) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_i128(i: i128) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn to_i8(&self) -> Option<i8>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_i16(&self) -> Option<i16>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_i32(&self) -> Option<i32>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_i64(&self) -> Option<i64>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_i128(&self) -> Option<i128>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn from_u8(i: u8) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_u16(i: u16) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_u32(i: u32) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_u64(i: u64) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn from_u128(i: u128) -> BigBitstring

Convert an integer into a decimal.

source§

impl BigBitstring

source

pub fn to_u8(&self) -> Option<u8>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_u16(&self) -> Option<u16>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_u32(&self) -> Option<u32>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_u64(&self) -> Option<u64>

Try convert a decimal into an integer.

source§

impl BigBitstring

source

pub fn to_u128(&self) -> Option<u128>

Try convert a decimal into an integer.

Trait Implementations§

source§

impl Debug for BigBitstring

source§

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

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

impl Display for BigBitstring

source§

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

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

impl From<f32> for BigBitstring

source§

fn from(f: f32) -> BigBitstring

Converts to this type from the input type.
source§

impl From<f64> for BigBitstring

source§

fn from(f: f64) -> BigBitstring

Converts to this type from the input type.
source§

impl From<i128> for BigBitstring

source§

fn from(i: i128) -> BigBitstring

Converts to this type from the input type.
source§

impl From<i16> for BigBitstring

source§

fn from(i: i16) -> BigBitstring

Converts to this type from the input type.
source§

impl From<i32> for BigBitstring

source§

fn from(i: i32) -> BigBitstring

Converts to this type from the input type.
source§

impl From<i64> for BigBitstring

source§

fn from(i: i64) -> BigBitstring

Converts to this type from the input type.
source§

impl From<i8> for BigBitstring

source§

fn from(i: i8) -> BigBitstring

Converts to this type from the input type.
source§

impl From<u128> for BigBitstring

source§

fn from(i: u128) -> BigBitstring

Converts to this type from the input type.
source§

impl From<u16> for BigBitstring

source§

fn from(i: u16) -> BigBitstring

Converts to this type from the input type.
source§

impl From<u32> for BigBitstring

source§

fn from(i: u32) -> BigBitstring

Converts to this type from the input type.
source§

impl From<u64> for BigBitstring

source§

fn from(i: u64) -> BigBitstring

Converts to this type from the input type.
source§

impl From<u8> for BigBitstring

source§

fn from(i: u8) -> BigBitstring

Converts to this type from the input type.
source§

impl FromStr for BigBitstring

§

type Err = Error

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

fn from_str(s: &str) -> Result<BigBitstring, Self::Err>

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

impl<'a> TryFrom<&'a str> for BigBitstring

§

type Error = Error

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

fn try_from(s: &'a str) -> Result<BigBitstring, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for f32

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<f32, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for f64

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<f64, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for i128

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<i128, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for i16

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<i16, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for i32

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<i32, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for i64

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<i64, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for i8

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<i8, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for u128

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<u128, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for u16

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<u16, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for u32

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<u32, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for u64

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<u64, Self::Error>

Performs the conversion.
source§

impl TryFrom<BigBitstring> for u8

§

type Error = Error

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

fn try_from(d: BigBitstring) -> Result<u8, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToString for Twhere 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 Twhere 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 Twhere 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.