pub struct DecimalExt { /* private fields */ }
Expand description
DecimalExt: Implements a signed version of cosmwasm_std::Decimal
with extentions for generating protobuf type strings.
Implementations§
Source§impl DecimalExt
impl DecimalExt
pub fn zero() -> Self
Sourcepub fn abc_cw_dec(&self) -> Decimal
pub fn abc_cw_dec(&self) -> Decimal
Getter for the underlying cosmwasm_std::Decimal
.
pub fn add(&self, other: Self) -> Self
pub fn neg(&self) -> Self
pub fn sub(&self, other: Self) -> Self
pub fn mul(&self, other: Self) -> Self
pub fn quo(&self, other: Self) -> Result<Self, MathError>
Source§impl DecimalExt
impl DecimalExt
pub fn precision_digits() -> usize
Sourcepub fn to_sdk_dec(&self) -> Result<SdkDec, MathError>
pub fn to_sdk_dec(&self) -> Result<SdkDec, MathError>
to_sdk_dec_pb_repr: Encodes the DecimalExt
from the human readable
form to the corresponding SdkDec (cosmossdk.io/math.LegacyDec
).
Sourcepub fn to_sdk_dec_pb_repr(&self) -> Result<String, MathError>
pub fn to_sdk_dec_pb_repr(&self) -> Result<String, MathError>
to_sdk_dec_pb_repr: Encodes the DecimalExt
its SdkDec
(cosmossdk.io/math.LegacyDec
) protobuf representation.
pub fn from_sdk_dec(sdk_dec_str: &str) -> Result<DecimalExt, MathError>
Trait Implementations§
Source§impl Clone for DecimalExt
impl Clone for DecimalExt
Source§fn clone(&self) -> DecimalExt
fn clone(&self) -> DecimalExt
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 DecimalExt
impl Debug for DecimalExt
Source§impl Default for DecimalExt
impl Default for DecimalExt
Source§fn default() -> DecimalExt
fn default() -> DecimalExt
Returns the “default value” for a type. Read more
Source§impl Display for DecimalExt
impl Display for DecimalExt
Source§impl From<Decimal> for DecimalExt
impl From<Decimal> for DecimalExt
Source§impl FromStr for DecimalExt
impl FromStr for DecimalExt
Source§impl Ord for DecimalExt
impl Ord for DecimalExt
Source§fn cmp(&self, other: &DecimalExt) -> Ordering
fn cmp(&self, other: &DecimalExt) -> 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 DecimalExt
impl PartialEq for DecimalExt
Source§impl PartialOrd for DecimalExt
impl PartialOrd for DecimalExt
impl Copy for DecimalExt
impl Eq for DecimalExt
impl StructuralPartialEq for DecimalExt
Auto Trait Implementations§
impl Freeze for DecimalExt
impl RefUnwindSafe for DecimalExt
impl Send for DecimalExt
impl Sync for DecimalExt
impl Unpin for DecimalExt
impl UnwindSafe for DecimalExt
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§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>
Converts
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>
Converts
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