pub struct SignedDecimal256(/* private fields */);Expand description
A signed fixed-point decimal value with 18 fractional digits, i.e. SignedDecimal256(1_000_000_000_000_000_000) == 1.0
The greatest possible value that can be represented is 57896044618658097711785492504343953926634992332820282019728.792003956564819967 (which is (2^255 - 1) / 10^18) and the smallest is -57896044618658097711785492504343953926634992332820282019728.792003956564819968 (which is -2^255 / 10^18).
Implementations§
Source§impl SignedDecimal256
impl SignedDecimal256
Sourcepub const DECIMAL_PLACES: u32 = 18u32
pub const DECIMAL_PLACES: u32 = 18u32
The number of decimal places. Since decimal types are fixed-point rather than floating-point, this is a constant.
Sourcepub const MAX: SignedDecimal256
pub const MAX: SignedDecimal256
The largest value that can be represented by this signed decimal type.
§Examples
assert_eq!(
SignedDecimal256::MAX.to_string(),
"57896044618658097711785492504343953926634992332820282019728.792003956564819967"
);Sourcepub const MIN: SignedDecimal256
pub const MIN: SignedDecimal256
The smallest value that can be represented by this signed decimal type.
§Examples
assert_eq!(
SignedDecimal256::MIN.to_string(),
"-57896044618658097711785492504343953926634992332820282019728.792003956564819968"
);Sourcepub const fn new(value: Int256) -> SignedDecimal256
pub const fn new(value: Int256) -> SignedDecimal256
Creates a SignedDecimal256(value)
This is equivalent to SignedDecimal256::from_atomics(value, 18) but usable in a const context.
§Examples
assert_eq!(SignedDecimal256::new(Int256::one()).to_string(), "0.000000000000000001");Sourcepub const fn raw(value: i128) -> SignedDecimal256
pub const fn raw(value: i128) -> SignedDecimal256
Creates a SignedDecimal256(Int256(value))
This is equivalent to SignedDecimal256::from_atomics(value, 18) but usable in a const context.
§Examples
assert_eq!(SignedDecimal256::raw(1234i128).to_string(), "0.000000000000001234");Sourcepub const fn one() -> SignedDecimal256
pub const fn one() -> SignedDecimal256
Create a 1.0 SignedDecimal256
Sourcepub const fn negative_one() -> SignedDecimal256
pub const fn negative_one() -> SignedDecimal256
Create a -1.0 SignedDecimal256
Sourcepub const fn zero() -> SignedDecimal256
pub const fn zero() -> SignedDecimal256
Create a 0.0 SignedDecimal256
Sourcepub fn percent(x: i64) -> SignedDecimal256
pub fn percent(x: i64) -> SignedDecimal256
Convert x% into SignedDecimal256
Sourcepub fn permille(x: i64) -> SignedDecimal256
pub fn permille(x: i64) -> SignedDecimal256
Convert permille (x/1000) into SignedDecimal256
Sourcepub fn bps(x: i64) -> SignedDecimal256
pub fn bps(x: i64) -> SignedDecimal256
Convert basis points (x/10000) into SignedDecimal256
Sourcepub fn from_atomics(
atomics: impl Into<Int256>,
decimal_places: u32,
) -> Result<SignedDecimal256, SignedDecimal256RangeExceeded>
pub fn from_atomics( atomics: impl Into<Int256>, decimal_places: u32, ) -> Result<SignedDecimal256, SignedDecimal256RangeExceeded>
Creates a signed decimal from a number of atomic units and the number of decimal places. The inputs will be converted internally to form a signed decimal with 18 decimal places. So the input 123 and 2 will create the decimal 1.23.
Using 18 decimal places is slightly more efficient than other values as no internal conversion is necessary.
§Examples
let a = SignedDecimal256::from_atomics(Int256::from(1234), 3).unwrap();
assert_eq!(a.to_string(), "1.234");
let a = SignedDecimal256::from_atomics(1234i128, 0).unwrap();
assert_eq!(a.to_string(), "1234");
let a = SignedDecimal256::from_atomics(1i64, 18).unwrap();
assert_eq!(a.to_string(), "0.000000000000000001");
let a = SignedDecimal256::from_atomics(-1i64, 18).unwrap();
assert_eq!(a.to_string(), "-0.000000000000000001");Sourcepub fn from_ratio(
numerator: impl Into<Int256>,
denominator: impl Into<Int256>,
) -> SignedDecimal256
pub fn from_ratio( numerator: impl Into<Int256>, denominator: impl Into<Int256>, ) -> SignedDecimal256
Returns the ratio (numerator / denominator) as a SignedDecimal256
§Examples
assert_eq!(
SignedDecimal256::from_ratio(1, 3).to_string(),
"0.333333333333333333"
);Sourcepub fn checked_from_ratio(
numerator: impl Into<Int256>,
denominator: impl Into<Int256>,
) -> Result<SignedDecimal256, CheckedFromRatioError>
pub fn checked_from_ratio( numerator: impl Into<Int256>, denominator: impl Into<Int256>, ) -> Result<SignedDecimal256, CheckedFromRatioError>
Returns the ratio (numerator / denominator) as a SignedDecimal256
§Examples
assert_eq!(
SignedDecimal256::checked_from_ratio(1, 3).unwrap().to_string(),
"0.333333333333333333"
);
assert_eq!(
SignedDecimal256::checked_from_ratio(1, 0),
Err(CheckedFromRatioError::DivideByZero)
);Sourcepub const fn is_negative(&self) -> bool
pub const fn is_negative(&self) -> bool
Returns true if the number is negative (< 0)
Sourcepub const fn atomics(&self) -> Int256
pub const fn atomics(&self) -> Int256
A decimal is an integer of atomic units plus a number that specifies the position of the decimal dot. So any decimal can be expressed as two numbers.
§Examples
// Value with whole and fractional part
let a = SignedDecimal256::from_str("1.234").unwrap();
assert_eq!(a.decimal_places(), 18);
assert_eq!(a.atomics(), Int256::from(1234000000000000000i128));
// Smallest possible value
let b = SignedDecimal256::from_str("0.000000000000000001").unwrap();
assert_eq!(b.decimal_places(), 18);
assert_eq!(b.atomics(), Int256::from(1));Sourcepub const fn decimal_places(&self) -> u32
pub const fn decimal_places(&self) -> u32
The number of decimal places. This is a constant value for now but this could potentially change as the type evolves.
See also SignedDecimal256::atomics().
Sourcepub fn trunc(&self) -> SignedDecimal256
pub fn trunc(&self) -> SignedDecimal256
Rounds value by truncating the decimal places.
§Examples
assert!(SignedDecimal256::from_str("0.6").unwrap().trunc().is_zero());
assert_eq!(SignedDecimal256::from_str("-5.8").unwrap().trunc().to_string(), "-5");Sourcepub fn floor(&self) -> SignedDecimal256
pub fn floor(&self) -> SignedDecimal256
Rounds value down after decimal places. Panics on overflow.
§Examples
assert!(SignedDecimal256::from_str("0.6").unwrap().floor().is_zero());
assert_eq!(SignedDecimal256::from_str("-5.2").unwrap().floor().to_string(), "-6");Sourcepub fn checked_floor(&self) -> Result<SignedDecimal256, RoundDownOverflowError>
pub fn checked_floor(&self) -> Result<SignedDecimal256, RoundDownOverflowError>
Rounds value down after decimal places.
Sourcepub fn ceil(&self) -> SignedDecimal256
pub fn ceil(&self) -> SignedDecimal256
Rounds value up after decimal places. Panics on overflow.
§Examples
assert_eq!(SignedDecimal256::from_str("0.2").unwrap().ceil(), SignedDecimal256::one());
assert_eq!(SignedDecimal256::from_str("-5.8").unwrap().ceil().to_string(), "-5");Sourcepub fn checked_ceil(&self) -> Result<SignedDecimal256, RoundUpOverflowError>
pub fn checked_ceil(&self) -> Result<SignedDecimal256, RoundUpOverflowError>
Rounds value up after decimal places. Returns OverflowError on overflow.
Sourcepub fn checked_add(
self,
other: SignedDecimal256,
) -> Result<SignedDecimal256, OverflowError>
pub fn checked_add( self, other: SignedDecimal256, ) -> Result<SignedDecimal256, OverflowError>
Computes self + other, returning an OverflowError if an overflow occurred.
Sourcepub fn checked_sub(
self,
other: SignedDecimal256,
) -> Result<SignedDecimal256, OverflowError>
pub fn checked_sub( self, other: SignedDecimal256, ) -> Result<SignedDecimal256, OverflowError>
Computes self - other, returning an OverflowError if an overflow occurred.
Sourcepub fn checked_mul(
self,
other: SignedDecimal256,
) -> Result<SignedDecimal256, OverflowError>
pub fn checked_mul( self, other: SignedDecimal256, ) -> Result<SignedDecimal256, OverflowError>
Multiplies one SignedDecimal256 by another, returning an OverflowError if an overflow occurred.
Sourcepub fn pow(self, exp: u32) -> SignedDecimal256
pub fn pow(self, exp: u32) -> SignedDecimal256
Raises a value to the power of exp, panics if an overflow occurred.
Sourcepub fn checked_pow(self, exp: u32) -> Result<SignedDecimal256, OverflowError>
pub fn checked_pow(self, exp: u32) -> Result<SignedDecimal256, OverflowError>
Raises a value to the power of exp, returning an OverflowError if an overflow occurred.
pub fn checked_div( self, other: SignedDecimal256, ) -> Result<SignedDecimal256, CheckedFromRatioError>
Sourcepub fn checked_rem(
self,
other: SignedDecimal256,
) -> Result<SignedDecimal256, DivideByZeroError>
pub fn checked_rem( self, other: SignedDecimal256, ) -> Result<SignedDecimal256, DivideByZeroError>
Computes self % other, returning an DivideByZeroError if other == 0.
pub const fn abs_diff(self, other: SignedDecimal256) -> Decimal256
pub fn saturating_add(self, other: SignedDecimal256) -> SignedDecimal256
pub fn saturating_sub(self, other: SignedDecimal256) -> SignedDecimal256
pub fn saturating_mul(self, other: SignedDecimal256) -> SignedDecimal256
pub fn saturating_pow(self, exp: u32) -> SignedDecimal256
Sourcepub fn to_int_floor(self) -> Int256
pub fn to_int_floor(self) -> Int256
Converts this decimal to a signed integer by rounding down to the next integer, e.g. 22.5 becomes 22 and -1.2 becomes -2.
§Examples
use core::str::FromStr;
use cosmwasm_std::{SignedDecimal256, Int256};
let d = SignedDecimal256::from_str("12.345").unwrap();
assert_eq!(d.to_int_floor(), Int256::from(12));
let d = SignedDecimal256::from_str("-12.999").unwrap();
assert_eq!(d.to_int_floor(), Int256::from(-13));
let d = SignedDecimal256::from_str("-0.05").unwrap();
assert_eq!(d.to_int_floor(), Int256::from(-1));Sourcepub fn to_int_trunc(self) -> Int256
pub fn to_int_trunc(self) -> Int256
Converts this decimal to a signed integer by truncating the fractional part, e.g. 22.5 becomes 22.
§Examples
use core::str::FromStr;
use cosmwasm_std::{SignedDecimal256, Int256};
let d = SignedDecimal256::from_str("12.345").unwrap();
assert_eq!(d.to_int_trunc(), Int256::from(12));
let d = SignedDecimal256::from_str("-12.999").unwrap();
assert_eq!(d.to_int_trunc(), Int256::from(-12));
let d = SignedDecimal256::from_str("75.0").unwrap();
assert_eq!(d.to_int_trunc(), Int256::from(75));Sourcepub fn to_int_ceil(self) -> Int256
pub fn to_int_ceil(self) -> Int256
Converts this decimal to a signed integer by rounding up to the next integer, e.g. 22.3 becomes 23 and -1.2 becomes -1.
§Examples
use core::str::FromStr;
use cosmwasm_std::{SignedDecimal256, Int256};
let d = SignedDecimal256::from_str("12.345").unwrap();
assert_eq!(d.to_int_ceil(), Int256::from(13));
let d = SignedDecimal256::from_str("-12.999").unwrap();
assert_eq!(d.to_int_ceil(), Int256::from(-12));
let d = SignedDecimal256::from_str("75.0").unwrap();
assert_eq!(d.to_int_ceil(), Int256::from(75));Trait Implementations§
Source§impl Add<&SignedDecimal256> for &SignedDecimal256
impl Add<&SignedDecimal256> for &SignedDecimal256
Source§type Output = <SignedDecimal256 as Add>::Output
type Output = <SignedDecimal256 as Add>::Output
+ operator.Source§fn add(self, other: &SignedDecimal256) -> <SignedDecimal256 as Add>::Output
fn add(self, other: &SignedDecimal256) -> <SignedDecimal256 as Add>::Output
+ operation. Read moreSource§impl Add<&SignedDecimal256> for SignedDecimal256
impl Add<&SignedDecimal256> for SignedDecimal256
Source§type Output = <SignedDecimal256 as Add>::Output
type Output = <SignedDecimal256 as Add>::Output
+ operator.Source§fn add(self, other: &SignedDecimal256) -> <SignedDecimal256 as Add>::Output
fn add(self, other: &SignedDecimal256) -> <SignedDecimal256 as Add>::Output
+ operation. Read moreSource§impl<'a> Add<SignedDecimal256> for &'a SignedDecimal256
impl<'a> Add<SignedDecimal256> for &'a SignedDecimal256
Source§type Output = <SignedDecimal256 as Add>::Output
type Output = <SignedDecimal256 as Add>::Output
+ operator.Source§fn add(self, other: SignedDecimal256) -> <SignedDecimal256 as Add>::Output
fn add(self, other: SignedDecimal256) -> <SignedDecimal256 as Add>::Output
+ operation. Read moreSource§impl Add for SignedDecimal256
impl Add for SignedDecimal256
Source§type Output = SignedDecimal256
type Output = SignedDecimal256
+ operator.Source§fn add(self, other: SignedDecimal256) -> SignedDecimal256
fn add(self, other: SignedDecimal256) -> SignedDecimal256
+ operation. Read moreSource§impl AddAssign<&SignedDecimal256> for SignedDecimal256
impl AddAssign<&SignedDecimal256> for SignedDecimal256
Source§fn add_assign(&mut self, other: &SignedDecimal256)
fn add_assign(&mut self, other: &SignedDecimal256)
+= operation. Read moreSource§impl AddAssign for SignedDecimal256
impl AddAssign for SignedDecimal256
Source§fn add_assign(&mut self, rhs: SignedDecimal256)
fn add_assign(&mut self, rhs: SignedDecimal256)
+= operation. Read moreSource§impl Clone for SignedDecimal256
impl Clone for SignedDecimal256
Source§fn clone(&self) -> SignedDecimal256
fn clone(&self) -> SignedDecimal256
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SignedDecimal256
impl Debug for SignedDecimal256
Source§impl Default for SignedDecimal256
impl Default for SignedDecimal256
Source§fn default() -> SignedDecimal256
fn default() -> SignedDecimal256
Source§impl<'de> Deserialize<'de> for SignedDecimal256
Deserializes as a base64 string
impl<'de> Deserialize<'de> for SignedDecimal256
Deserializes as a base64 string
Source§fn deserialize<D>(
deserializer: D,
) -> Result<SignedDecimal256, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SignedDecimal256, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for SignedDecimal256
impl Display for SignedDecimal256
Source§impl Div<&SignedDecimal256> for &SignedDecimal256
impl Div<&SignedDecimal256> for &SignedDecimal256
Source§type Output = <SignedDecimal256 as Div>::Output
type Output = <SignedDecimal256 as Div>::Output
/ operator.Source§fn div(self, other: &SignedDecimal256) -> <SignedDecimal256 as Div>::Output
fn div(self, other: &SignedDecimal256) -> <SignedDecimal256 as Div>::Output
/ operation. Read moreSource§impl Div<&SignedDecimal256> for SignedDecimal256
impl Div<&SignedDecimal256> for SignedDecimal256
Source§type Output = <SignedDecimal256 as Div>::Output
type Output = <SignedDecimal256 as Div>::Output
/ operator.Source§fn div(self, other: &SignedDecimal256) -> <SignedDecimal256 as Div>::Output
fn div(self, other: &SignedDecimal256) -> <SignedDecimal256 as Div>::Output
/ operation. Read moreSource§impl Div<Int256> for SignedDecimal256
impl Div<Int256> for SignedDecimal256
Source§impl<'a> Div<SignedDecimal256> for &'a SignedDecimal256
impl<'a> Div<SignedDecimal256> for &'a SignedDecimal256
Source§type Output = <SignedDecimal256 as Div>::Output
type Output = <SignedDecimal256 as Div>::Output
/ operator.Source§fn div(self, other: SignedDecimal256) -> <SignedDecimal256 as Div>::Output
fn div(self, other: SignedDecimal256) -> <SignedDecimal256 as Div>::Output
/ operation. Read moreSource§impl Div for SignedDecimal256
impl Div for SignedDecimal256
Source§type Output = SignedDecimal256
type Output = SignedDecimal256
/ operator.Source§fn div(self, other: SignedDecimal256) -> SignedDecimal256
fn div(self, other: SignedDecimal256) -> SignedDecimal256
/ operation. Read moreSource§impl DivAssign<&SignedDecimal256> for SignedDecimal256
impl DivAssign<&SignedDecimal256> for SignedDecimal256
Source§fn div_assign(&mut self, other: &SignedDecimal256)
fn div_assign(&mut self, other: &SignedDecimal256)
/= operation. Read moreSource§impl DivAssign<Int256> for SignedDecimal256
impl DivAssign<Int256> for SignedDecimal256
Source§fn div_assign(&mut self, rhs: Int256)
fn div_assign(&mut self, rhs: Int256)
/= operation. Read moreSource§impl DivAssign for SignedDecimal256
impl DivAssign for SignedDecimal256
Source§fn div_assign(&mut self, rhs: SignedDecimal256)
fn div_assign(&mut self, rhs: SignedDecimal256)
/= operation. Read moreSource§impl Fraction<Int256> for SignedDecimal256
impl Fraction<Int256> for SignedDecimal256
Source§impl From<Decimal> for SignedDecimal256
impl From<Decimal> for SignedDecimal256
Source§fn from(value: Decimal) -> SignedDecimal256
fn from(value: Decimal) -> SignedDecimal256
Source§impl From<SignedDecimal> for SignedDecimal256
impl From<SignedDecimal> for SignedDecimal256
Source§fn from(value: SignedDecimal) -> SignedDecimal256
fn from(value: SignedDecimal) -> SignedDecimal256
Source§impl FromStr for SignedDecimal256
impl FromStr for SignedDecimal256
Source§fn from_str(
input: &str,
) -> Result<SignedDecimal256, <SignedDecimal256 as FromStr>::Err>
fn from_str( input: &str, ) -> Result<SignedDecimal256, <SignedDecimal256 as FromStr>::Err>
Converts the decimal string to a SignedDecimal256 Possible inputs: “1.23”, “1”, “000012”, “1.123000000”, “-1.12300” Disallowed: “”, “.23”
This never performs any kind of rounding. More than DECIMAL_PLACES fractional digits, even zeros, result in an error.
Source§impl JsonSchema for SignedDecimal256
impl JsonSchema for SignedDecimal256
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Mul<&SignedDecimal256> for &SignedDecimal256
impl Mul<&SignedDecimal256> for &SignedDecimal256
Source§type Output = <SignedDecimal256 as Mul>::Output
type Output = <SignedDecimal256 as Mul>::Output
* operator.Source§fn mul(self, other: &SignedDecimal256) -> <SignedDecimal256 as Mul>::Output
fn mul(self, other: &SignedDecimal256) -> <SignedDecimal256 as Mul>::Output
* operation. Read moreSource§impl Mul<&SignedDecimal256> for SignedDecimal256
impl Mul<&SignedDecimal256> for SignedDecimal256
Source§type Output = <SignedDecimal256 as Mul>::Output
type Output = <SignedDecimal256 as Mul>::Output
* operator.Source§fn mul(self, other: &SignedDecimal256) -> <SignedDecimal256 as Mul>::Output
fn mul(self, other: &SignedDecimal256) -> <SignedDecimal256 as Mul>::Output
* operation. Read moreSource§impl<'a> Mul<SignedDecimal256> for &'a SignedDecimal256
impl<'a> Mul<SignedDecimal256> for &'a SignedDecimal256
Source§type Output = <SignedDecimal256 as Mul>::Output
type Output = <SignedDecimal256 as Mul>::Output
* operator.Source§fn mul(self, other: SignedDecimal256) -> <SignedDecimal256 as Mul>::Output
fn mul(self, other: SignedDecimal256) -> <SignedDecimal256 as Mul>::Output
* operation. Read moreSource§impl Mul for SignedDecimal256
impl Mul for SignedDecimal256
Source§type Output = SignedDecimal256
type Output = SignedDecimal256
* operator.Source§fn mul(self, other: SignedDecimal256) -> SignedDecimal256
fn mul(self, other: SignedDecimal256) -> SignedDecimal256
* operation. Read moreSource§impl MulAssign<&SignedDecimal256> for SignedDecimal256
impl MulAssign<&SignedDecimal256> for SignedDecimal256
Source§fn mul_assign(&mut self, other: &SignedDecimal256)
fn mul_assign(&mut self, other: &SignedDecimal256)
*= operation. Read moreSource§impl MulAssign for SignedDecimal256
impl MulAssign for SignedDecimal256
Source§fn mul_assign(&mut self, rhs: SignedDecimal256)
fn mul_assign(&mut self, rhs: SignedDecimal256)
*= operation. Read moreSource§impl Neg for SignedDecimal256
impl Neg for SignedDecimal256
Source§impl Ord for SignedDecimal256
impl Ord for SignedDecimal256
Source§fn cmp(&self, other: &SignedDecimal256) -> Ordering
fn cmp(&self, other: &SignedDecimal256) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<&SignedDecimal256> for SignedDecimal256
impl PartialEq<&SignedDecimal256> for SignedDecimal256
Source§impl<'a> PartialEq<SignedDecimal256> for &'a SignedDecimal256
impl<'a> PartialEq<SignedDecimal256> for &'a SignedDecimal256
Source§impl PartialEq for SignedDecimal256
impl PartialEq for SignedDecimal256
Source§impl PartialOrd for SignedDecimal256
impl PartialOrd for SignedDecimal256
Source§impl Rem<&SignedDecimal256> for &SignedDecimal256
impl Rem<&SignedDecimal256> for &SignedDecimal256
Source§type Output = <SignedDecimal256 as Rem>::Output
type Output = <SignedDecimal256 as Rem>::Output
% operator.Source§fn rem(self, other: &SignedDecimal256) -> <SignedDecimal256 as Rem>::Output
fn rem(self, other: &SignedDecimal256) -> <SignedDecimal256 as Rem>::Output
% operation. Read moreSource§impl Rem<&SignedDecimal256> for SignedDecimal256
impl Rem<&SignedDecimal256> for SignedDecimal256
Source§type Output = <SignedDecimal256 as Rem>::Output
type Output = <SignedDecimal256 as Rem>::Output
% operator.Source§fn rem(self, other: &SignedDecimal256) -> <SignedDecimal256 as Rem>::Output
fn rem(self, other: &SignedDecimal256) -> <SignedDecimal256 as Rem>::Output
% operation. Read moreSource§impl<'a> Rem<SignedDecimal256> for &'a SignedDecimal256
impl<'a> Rem<SignedDecimal256> for &'a SignedDecimal256
Source§type Output = <SignedDecimal256 as Rem>::Output
type Output = <SignedDecimal256 as Rem>::Output
% operator.Source§fn rem(self, other: SignedDecimal256) -> <SignedDecimal256 as Rem>::Output
fn rem(self, other: SignedDecimal256) -> <SignedDecimal256 as Rem>::Output
% operation. Read moreSource§impl Rem for SignedDecimal256
impl Rem for SignedDecimal256
Source§fn rem(self, rhs: SignedDecimal256) -> SignedDecimal256
fn rem(self, rhs: SignedDecimal256) -> SignedDecimal256
§Panics
This operation will panic if rhs is zero
Source§type Output = SignedDecimal256
type Output = SignedDecimal256
% operator.Source§impl RemAssign<&SignedDecimal256> for SignedDecimal256
impl RemAssign<&SignedDecimal256> for SignedDecimal256
Source§fn rem_assign(&mut self, other: &SignedDecimal256)
fn rem_assign(&mut self, other: &SignedDecimal256)
%= operation. Read moreSource§impl RemAssign for SignedDecimal256
impl RemAssign for SignedDecimal256
Source§fn rem_assign(&mut self, rhs: SignedDecimal256)
fn rem_assign(&mut self, rhs: SignedDecimal256)
%= operation. Read moreSource§impl Serialize for SignedDecimal256
Serializes as a decimal string
impl Serialize for SignedDecimal256
Serializes as a decimal string
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl Sub<&SignedDecimal256> for &SignedDecimal256
impl Sub<&SignedDecimal256> for &SignedDecimal256
Source§type Output = <SignedDecimal256 as Sub>::Output
type Output = <SignedDecimal256 as Sub>::Output
- operator.Source§fn sub(self, other: &SignedDecimal256) -> <SignedDecimal256 as Sub>::Output
fn sub(self, other: &SignedDecimal256) -> <SignedDecimal256 as Sub>::Output
- operation. Read moreSource§impl Sub<&SignedDecimal256> for SignedDecimal256
impl Sub<&SignedDecimal256> for SignedDecimal256
Source§type Output = <SignedDecimal256 as Sub>::Output
type Output = <SignedDecimal256 as Sub>::Output
- operator.Source§fn sub(self, other: &SignedDecimal256) -> <SignedDecimal256 as Sub>::Output
fn sub(self, other: &SignedDecimal256) -> <SignedDecimal256 as Sub>::Output
- operation. Read moreSource§impl<'a> Sub<SignedDecimal256> for &'a SignedDecimal256
impl<'a> Sub<SignedDecimal256> for &'a SignedDecimal256
Source§type Output = <SignedDecimal256 as Sub>::Output
type Output = <SignedDecimal256 as Sub>::Output
- operator.Source§fn sub(self, other: SignedDecimal256) -> <SignedDecimal256 as Sub>::Output
fn sub(self, other: SignedDecimal256) -> <SignedDecimal256 as Sub>::Output
- operation. Read moreSource§impl Sub for SignedDecimal256
impl Sub for SignedDecimal256
Source§type Output = SignedDecimal256
type Output = SignedDecimal256
- operator.Source§fn sub(self, other: SignedDecimal256) -> SignedDecimal256
fn sub(self, other: SignedDecimal256) -> SignedDecimal256
- operation. Read moreSource§impl SubAssign<&SignedDecimal256> for SignedDecimal256
impl SubAssign<&SignedDecimal256> for SignedDecimal256
Source§fn sub_assign(&mut self, other: &SignedDecimal256)
fn sub_assign(&mut self, other: &SignedDecimal256)
-= operation. Read moreSource§impl SubAssign for SignedDecimal256
impl SubAssign for SignedDecimal256
Source§fn sub_assign(&mut self, rhs: SignedDecimal256)
fn sub_assign(&mut self, rhs: SignedDecimal256)
-= operation. Read moreSource§impl<A> Sum<A> for SignedDecimal256
impl<A> Sum<A> for SignedDecimal256
Source§fn sum<I>(iter: I) -> SignedDecimal256where
I: Iterator<Item = A>,
fn sum<I>(iter: I) -> SignedDecimal256where
I: Iterator<Item = A>,
Self from the elements by “summing up”
the items.Source§impl TryFrom<Decimal256> for SignedDecimal256
impl TryFrom<Decimal256> for SignedDecimal256
Source§type Error = SignedDecimal256RangeExceeded
type Error = SignedDecimal256RangeExceeded
Source§fn try_from(
value: Decimal256,
) -> Result<SignedDecimal256, <SignedDecimal256 as TryFrom<Decimal256>>::Error>
fn try_from( value: Decimal256, ) -> Result<SignedDecimal256, <SignedDecimal256 as TryFrom<Decimal256>>::Error>
Source§impl TryFrom<Int256> for SignedDecimal256
impl TryFrom<Int256> for SignedDecimal256
Source§type Error = SignedDecimal256RangeExceeded
type Error = SignedDecimal256RangeExceeded
Source§fn try_from(
value: Int256,
) -> Result<SignedDecimal256, <SignedDecimal256 as TryFrom<Int256>>::Error>
fn try_from( value: Int256, ) -> Result<SignedDecimal256, <SignedDecimal256 as TryFrom<Int256>>::Error>
Source§impl TryFrom<SignedDecimal256> for Decimal
impl TryFrom<SignedDecimal256> for Decimal
Source§type Error = DecimalRangeExceeded
type Error = DecimalRangeExceeded
Source§fn try_from(
value: SignedDecimal256,
) -> Result<Decimal, <Decimal as TryFrom<SignedDecimal256>>::Error>
fn try_from( value: SignedDecimal256, ) -> Result<Decimal, <Decimal as TryFrom<SignedDecimal256>>::Error>
Source§impl TryFrom<SignedDecimal256> for Decimal256
impl TryFrom<SignedDecimal256> for Decimal256
Source§type Error = Decimal256RangeExceeded
type Error = Decimal256RangeExceeded
Source§fn try_from(
value: SignedDecimal256,
) -> Result<Decimal256, <Decimal256 as TryFrom<SignedDecimal256>>::Error>
fn try_from( value: SignedDecimal256, ) -> Result<Decimal256, <Decimal256 as TryFrom<SignedDecimal256>>::Error>
Source§impl TryFrom<SignedDecimal256> for SignedDecimal
impl TryFrom<SignedDecimal256> for SignedDecimal
Source§type Error = SignedDecimalRangeExceeded
type Error = SignedDecimalRangeExceeded
Source§fn try_from(
value: SignedDecimal256,
) -> Result<SignedDecimal, <SignedDecimal as TryFrom<SignedDecimal256>>::Error>
fn try_from( value: SignedDecimal256, ) -> Result<SignedDecimal, <SignedDecimal as TryFrom<SignedDecimal256>>::Error>
impl Copy for SignedDecimal256
impl Eq for SignedDecimal256
impl StructuralPartialEq for SignedDecimal256
Auto Trait Implementations§
impl Freeze for SignedDecimal256
impl RefUnwindSafe for SignedDecimal256
impl Send for SignedDecimal256
impl Sync for SignedDecimal256
impl Unpin for SignedDecimal256
impl UnwindSafe for SignedDecimal256
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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