Struct substreams::scalar::BigDecimal
source · pub struct BigDecimal(/* private fields */);
Implementations§
source§impl BigDecimal
impl BigDecimal
sourcepub const MIN_EXP: i32 = -6_143i32
pub const MIN_EXP: i32 = -6_143i32
These are the limits of IEEE-754 decimal128, a format we may want to switch to.
See https://en.wikipedia.org/wiki/Decimal128_floating-point_format
pub const MAX_EXP: i32 = 6_144i32
pub const MAX_SIGNIFICANT_DIGITS: i32 = 34i32
pub fn new(digits: BigInt, exp: i64) -> Self
pub fn parse_bytes(bytes: &[u8]) -> Option<Self>
pub fn zero() -> BigDecimal
pub fn one() -> BigDecimal
pub fn as_bigint_and_exponent(&self) -> (BigInt, i64)
pub fn digits(&self) -> u64
pub fn is_zero(&self) -> bool
pub fn with_prec(&self, prec: u64) -> BigDecimal
pub fn neg(&self) -> BigDecimal
pub fn from_store_bytes(bytes: &[u8]) -> BigDecimal
pub fn divide_by_decimals( big_decimal_amount: BigDecimal, decimals: u64, ) -> BigDecimal
pub fn absolute(&self) -> BigDecimal
pub fn to_bigint(&self) -> BigInt
Trait Implementations§
source§impl Add<BigDecimal> for BigInt
impl Add<BigDecimal> for BigInt
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
+
operator.source§fn add(self, other: BigDecimal) -> BigDecimal
fn add(self, other: BigDecimal) -> BigDecimal
Performs the
+
operation. Read moresource§impl<T> Add<T> for BigDecimalwhere
T: Into<BigDecimal>,
impl<T> Add<T> for BigDecimalwhere
T: Into<BigDecimal>,
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
+
operator.source§fn add(self, other: T) -> BigDecimal
fn add(self, other: T) -> BigDecimal
Performs the
+
operation. Read moresource§impl AsRef<BigDecimal> for BigDecimal
impl AsRef<BigDecimal> for BigDecimal
source§fn as_ref(&self) -> &BigDecimal
fn as_ref(&self) -> &BigDecimal
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for BigDecimal
impl Clone for BigDecimal
source§fn clone(&self) -> BigDecimal
fn clone(&self) -> BigDecimal
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for BigDecimal
impl Debug for BigDecimal
source§impl Default for BigDecimal
impl Default for BigDecimal
source§impl Display for BigDecimal
impl Display for BigDecimal
source§impl Div<&BigDecimal> for BigDecimal
impl Div<&BigDecimal> for BigDecimal
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
/
operator.source§fn div(self, other: &BigDecimal) -> BigDecimal
fn div(self, other: &BigDecimal) -> BigDecimal
Performs the
/
operation. Read moresource§impl Div<BigDecimal> for BigInt
impl Div<BigDecimal> for BigInt
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
/
operator.source§fn div(self, other: BigDecimal) -> BigDecimal
fn div(self, other: BigDecimal) -> BigDecimal
Performs the
/
operation. Read moresource§impl<T> Div<T> for BigDecimalwhere
T: Into<BigDecimal>,
impl<T> Div<T> for BigDecimalwhere
T: Into<BigDecimal>,
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
/
operator.source§fn div(self, rhs: T) -> BigDecimal
fn div(self, rhs: T) -> BigDecimal
Performs the
/
operation. Read moresource§impl From<&BigDecimal> for BigDecimal
impl From<&BigDecimal> for BigDecimal
source§fn from(big_decimal: &BigDecimal) -> Self
fn from(big_decimal: &BigDecimal) -> Self
Converts to this type from the input type.
source§impl From<BigDecimal> for BigDecimal
impl From<BigDecimal> for BigDecimal
source§fn from(big_decimal: BigDecimal) -> Self
fn from(big_decimal: BigDecimal) -> Self
Converts to this type from the input type.
source§impl From<BigInt> for BigDecimal
impl From<BigInt> for BigDecimal
source§impl From<BigUint> for BigDecimal
impl From<BigUint> for BigDecimal
source§impl From<i32> for BigDecimal
impl From<i32> for BigDecimal
source§impl From<i64> for BigDecimal
impl From<i64> for BigDecimal
source§impl From<u32> for BigDecimal
impl From<u32> for BigDecimal
source§impl From<u64> for BigDecimal
impl From<u64> for BigDecimal
source§impl From<usize> for BigDecimal
impl From<usize> for BigDecimal
source§impl FromStr for BigDecimal
impl FromStr for BigDecimal
source§impl Into<BigDecimal> for &BigInt
impl Into<BigDecimal> for &BigInt
source§fn into(self) -> BigDecimal
fn into(self) -> BigDecimal
Converts this type into the (usually inferred) input type.
source§impl Into<BigDecimal> for BigDecimal
impl Into<BigDecimal> for BigDecimal
source§fn into(self) -> BigDecimal
fn into(self) -> BigDecimal
Converts this type into the (usually inferred) input type.
source§impl Into<String> for &BigDecimal
impl Into<String> for &BigDecimal
source§impl Into<String> for BigDecimal
impl Into<String> for BigDecimal
source§impl Mul<BigDecimal> for BigInt
impl Mul<BigDecimal> for BigInt
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
*
operator.source§fn mul(self, other: BigDecimal) -> BigDecimal
fn mul(self, other: BigDecimal) -> BigDecimal
Performs the
*
operation. Read moresource§impl<T> Mul<T> for BigDecimalwhere
T: Into<BigDecimal>,
impl<T> Mul<T> for BigDecimalwhere
T: Into<BigDecimal>,
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
*
operator.source§fn mul(self, rhs: T) -> BigDecimal
fn mul(self, rhs: T) -> BigDecimal
Performs the
*
operation. Read moresource§impl Ord for BigDecimal
impl Ord for BigDecimal
source§fn cmp(&self, other: &BigDecimal) -> Ordering
fn cmp(&self, other: &BigDecimal) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for BigDecimal
impl PartialEq for BigDecimal
source§fn eq(&self, other: &BigDecimal) -> bool
fn eq(&self, other: &BigDecimal) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for BigDecimal
impl PartialOrd for BigDecimal
source§fn partial_cmp(&self, other: &BigDecimal) -> Option<Ordering>
fn partial_cmp(&self, other: &BigDecimal) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl StoreGet<BigDecimal> for StoreGetBigDecimal
impl StoreGet<BigDecimal> for StoreGetBigDecimal
fn new(idx: u32) -> Self
fn get_at<K: AsRef<str>>(&self, ord: u64, key: K) -> Option<BigDecimal>
fn get_last<K: AsRef<str>>(&self, key: K) -> Option<BigDecimal>
fn get_first<K: AsRef<str>>(&self, key: K) -> Option<BigDecimal>
fn has_at<K: AsRef<str>>(&self, ord: u64, key: K) -> bool
fn has_last<K: AsRef<str>>(&self, key: K) -> bool
fn has_first<K: AsRef<str>>(&self, key: K) -> bool
source§impl StoreSet<BigDecimal> for StoreSetBigDecimal
impl StoreSet<BigDecimal> for StoreSetBigDecimal
source§impl StoreSetIfNotExists<BigDecimal> for StoreSetIfNotExistsBigDecimal
impl StoreSetIfNotExists<BigDecimal> for StoreSetIfNotExistsBigDecimal
source§fn set_if_not_exists<K: AsRef<str>>(&self, ord: u64, key: K, value: &BigDecimal)
fn set_if_not_exists<K: AsRef<str>>(&self, ord: u64, key: K, value: &BigDecimal)
Set a given key to a given value, if the key existed before, it will be ignored and not set.
source§fn set_if_not_exists_many<K: AsRef<str>>(
&self,
ord: u64,
keys: &Vec<K>,
value: &BigDecimal,
)
fn set_if_not_exists_many<K: AsRef<str>>( &self, ord: u64, keys: &Vec<K>, value: &BigDecimal, )
Set given keys to given values, if the key existed before, it will be ignored and not set.
source§impl Sub<BigDecimal> for BigInt
impl Sub<BigDecimal> for BigInt
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
-
operator.source§fn sub(self, other: BigDecimal) -> BigDecimal
fn sub(self, other: BigDecimal) -> BigDecimal
Performs the
-
operation. Read moresource§impl<T> Sub<T> for BigDecimalwhere
T: Into<BigDecimal>,
impl<T> Sub<T> for BigDecimalwhere
T: Into<BigDecimal>,
§type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the
-
operator.source§fn sub(self, other: T) -> BigDecimal
fn sub(self, other: T) -> BigDecimal
Performs the
-
operation. Read moresource§impl ToPrimitive for BigDecimal
impl ToPrimitive for BigDecimal
source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
Converts the value of
self
to an i64
. If the value cannot be
represented by an i64
, then None
is returned.source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
Converts the value of
self
to a u64
. If the value cannot be
represented by a u64
, then None
is returned.source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
Converts the value of
self
to an isize
. If the value cannot be
represented by an isize
, then None
is returned.source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
Converts the value of
self
to an i8
. If the value cannot be
represented by an i8
, then None
is returned.source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
Converts the value of
self
to an i16
. If the value cannot be
represented by an i16
, then None
is returned.source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
Converts the value of
self
to an i32
. If the value cannot be
represented by an i32
, then None
is returned.source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
Converts the value of
self
to an i128
. If the value cannot be
represented by an i128
(i64
under the default implementation), then
None
is returned. Read moresource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
Converts the value of
self
to a usize
. If the value cannot be
represented by a usize
, then None
is returned.source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
Converts the value of
self
to a u8
. If the value cannot be
represented by a u8
, then None
is returned.source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
Converts the value of
self
to a u16
. If the value cannot be
represented by a u16
, then None
is returned.source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
Converts the value of
self
to a u32
. If the value cannot be
represented by a u32
, then None
is returned.source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
Converts the value of
self
to a u128
. If the value cannot be
represented by a u128
(u64
under the default implementation), then
None
is returned. Read moresource§impl TryFrom<&String> for BigDecimal
impl TryFrom<&String> for BigDecimal
source§impl TryFrom<&str> for BigDecimal
impl TryFrom<&str> for BigDecimal
source§impl TryFrom<String> for BigDecimal
impl TryFrom<String> for BigDecimal
source§impl TryFrom<f32> for BigDecimal
impl TryFrom<f32> for BigDecimal
source§impl TryFrom<f64> for BigDecimal
impl TryFrom<f64> for BigDecimal
impl Eq for BigDecimal
impl StructuralPartialEq for BigDecimal
Auto Trait Implementations§
impl Freeze for BigDecimal
impl RefUnwindSafe for BigDecimal
impl Send for BigDecimal
impl Sync for BigDecimal
impl Unpin for BigDecimal
impl UnwindSafe for BigDecimal
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)