pub struct Balance<C>(/* private fields */)
where
C: Currency;Expand description
Implementations§
Source§impl<C> Balance<C>where
C: Currency,
impl<C> Balance<C>where
C: Currency,
Sourcepub fn new_base<T>(value: T) -> Balance<C>where
T: Into<U256>,
pub fn new_base<T>(value: T) -> Balance<C>where
T: Into<U256>,
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, T> AddAssign<T> for Balance<C>
impl<C, T> 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> AddAssign for Balance<C>where
C: Currency,
impl<C> AddAssign for Balance<C>where
C: Currency,
Source§fn add_assign(&mut self, rhs: Balance<C>)
fn add_assign(&mut self, rhs: Balance<C>)
Performs the
+= operation. Read moreSource§impl<'de, C> Deserialize<'de> for Balance<C>where
C: Currency + Deserialize<'de>,
impl<'de, C> Deserialize<'de> for Balance<C>where
C: Currency + Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Balance<C>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Balance<C>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<C> IntoEndian<32> for Balance<C>where
C: Currency,
impl<C> IntoEndian<32> for Balance<C>where
C: Currency,
Source§fn from_be_bytes<T>(bytes: T) -> Balance<C>
fn from_be_bytes<T>(bytes: T) -> Balance<C>
Create an instance from Big Endian bytes. Should panic if size is more than
N.Source§fn from_le_bytes<T>(bytes: T) -> Balance<C>
fn from_le_bytes<T>(bytes: T) -> Balance<C>
Create an 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, T> MulAssign<T> for Balance<C>
impl<C, T> 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> MulAssign for Balance<C>where
C: Currency,
impl<C> MulAssign for Balance<C>where
C: Currency,
Source§fn mul_assign(&mut self, rhs: Balance<C>)
fn mul_assign(&mut self, rhs: Balance<C>)
Performs the
*= operation. Read moreSource§impl<C> Ord for Balance<C>
impl<C> 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 for Balance<C>where
C: PartialOrd + Currency,
impl<C> PartialOrd for Balance<C>where
C: PartialOrd + Currency,
Source§impl<C> Serialize for Balance<C>
impl<C> Serialize for Balance<C>
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,
Serialize this value into the given Serde serializer. Read more
Source§impl<C, T> SubAssign<T> for Balance<C>
impl<C, T> 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> SubAssign for Balance<C>where
C: Currency,
impl<C> SubAssign for Balance<C>where
C: Currency,
Source§fn sub_assign(&mut self, rhs: Balance<C>)
fn sub_assign(&mut self, rhs: Balance<C>)
Performs the
-= operation. Read moreSource§impl<C> UnitaryFloatOps for Balance<C>where
C: Currency,
impl<C> UnitaryFloatOps for Balance<C>where
C: Currency,
impl<C> Copy for Balance<C>
impl<C> Eq for Balance<C>
impl<C> StructuralPartialEq for Balance<C>where
C: Currency,
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> 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> Pointable for T
impl<T> Pointable for T
§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.