pub struct Balance<C: Currency>(/* private fields */);
Expand description
Implementations§
Source§impl<C: Currency> Balance<C>
impl<C: Currency> Balance<C>
Sourcepub fn new_base<T: Into<U256>>(value: T) -> Self
pub fn new_base<T: Into<U256>>(value: T) -> Self
Creates new balance in base units, instead of wei
.
Sourcepub fn amount_in_base_units(&self) -> String
pub fn amount_in_base_units(&self) -> String
Returns the amount in base units (human-readable), not in wei
.
Sourcepub fn format_in_wei(&self) -> String
pub fn format_in_wei(&self) -> String
Prints the balance formated in wei
units.
Trait Implementations§
Source§impl<C: Currency, T: Into<U256>> AddAssign<T> for Balance<C>
impl<C: Currency, T: Into<U256>> AddAssign<T> for Balance<C>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+=
operation. Read moreSource§impl<C: Currency> AddAssign for Balance<C>
impl<C: Currency> AddAssign for Balance<C>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<'de, C> Deserialize<'de> for Balance<C>where
C: Deserialize<'de> + Currency,
impl<'de, C> Deserialize<'de> for Balance<C>where
C: Deserialize<'de> + Currency,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<C: Currency> IntoEndian<32> for Balance<C>
impl<C: Currency> IntoEndian<32> for Balance<C>
Source§fn from_be_bytes<T: AsRef<[u8]>>(bytes: T) -> Self
fn from_be_bytes<T: AsRef<[u8]>>(bytes: T) -> Self
Create instance from Big Endian bytes. Should panic if size is more than
N
.Source§fn from_le_bytes<T: AsRef<[u8]>>(bytes: T) -> Self
fn from_le_bytes<T: AsRef<[u8]>>(bytes: T) -> Self
Create instance from Little Endian bytes. Should panic if size is more than
N
.Source§fn to_le_bytes(self) -> [u8; 32]
fn to_le_bytes(self) -> [u8; 32]
Convert instance to Little Endian bytes.
Source§fn to_be_bytes(self) -> [u8; 32]
fn to_be_bytes(self) -> [u8; 32]
Convert instance to Big Endian bytes.
Source§impl<C: Currency, T: Into<U256>> MulAssign<T> for Balance<C>
impl<C: Currency, T: Into<U256>> MulAssign<T> for Balance<C>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*=
operation. Read moreSource§impl<C: Currency> MulAssign for Balance<C>
impl<C: Currency> MulAssign for Balance<C>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl<C: Ord + Currency> Ord for Balance<C>
impl<C: Ord + Currency> Ord for Balance<C>
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<C: PartialOrd + Currency> PartialOrd for Balance<C>
impl<C: PartialOrd + Currency> PartialOrd for Balance<C>
Source§impl<C: Currency, T: Into<U256>> SubAssign<T> for Balance<C>
impl<C: Currency, T: Into<U256>> SubAssign<T> for Balance<C>
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-=
operation. Read moreSource§impl<C: Currency> SubAssign for Balance<C>
impl<C: Currency> SubAssign for Balance<C>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreSource§impl<C: Currency> UnitaryFloatOps for Balance<C>
impl<C: Currency> UnitaryFloatOps for Balance<C>
impl<C: Copy + Currency> Copy for Balance<C>
impl<C: Eq + Currency> Eq for Balance<C>
impl<C: Currency> StructuralPartialEq for Balance<C>
Auto Trait Implementations§
impl<C> Freeze for Balance<C>where
C: Freeze,
impl<C> RefUnwindSafe for Balance<C>where
C: RefUnwindSafe,
impl<C> Send for Balance<C>where
C: Send,
impl<C> Sync for Balance<C>where
C: Sync,
impl<C> Unpin for Balance<C>where
C: Unpin,
impl<C> UnwindSafe for Balance<C>where
C: UnwindSafe,
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.