Struct cw_utils::NativeBalance
source · pub struct NativeBalance(pub Vec<Coin>);
Tuple Fields§
§0: Vec<Coin>
Implementations§
source§impl NativeBalance
impl NativeBalance
pub fn into_vec(self) -> Vec<Coin>
sourcepub fn has(&self, required: &Coin) -> bool
pub fn has(&self, required: &Coin) -> bool
returns true if the list of coins has at least the required amount
sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
normalize Wallet (sorted by denom, no 0 elements, no duplicate denoms)
pub fn is_empty(&self) -> bool
sourcepub fn sub_saturating(self, other: Coin) -> StdResult<Self>
pub fn sub_saturating(self, other: Coin) -> StdResult<Self>
similar to Balance.sub
, but doesn’t fail when minuend less than subtrahend
Trait Implementations§
source§impl Add<Coin> for NativeBalance
impl Add<Coin> for NativeBalance
source§impl Add for NativeBalance
impl Add for NativeBalance
§type Output = NativeBalance
type Output = NativeBalance
The resulting type after applying the
+
operator.source§fn add(self, other: NativeBalance) -> Self
fn add(self, other: NativeBalance) -> Self
Performs the
+
operation. Read moresource§impl AddAssign<Coin> for NativeBalance
impl AddAssign<Coin> for NativeBalance
source§fn add_assign(&mut self, other: Coin)
fn add_assign(&mut self, other: Coin)
Performs the
+=
operation. Read moresource§impl AddAssign for NativeBalance
impl AddAssign for NativeBalance
source§fn add_assign(&mut self, other: NativeBalance)
fn add_assign(&mut self, other: NativeBalance)
Performs the
+=
operation. Read moresource§impl Clone for NativeBalance
impl Clone for NativeBalance
source§fn clone(&self) -> NativeBalance
fn clone(&self) -> NativeBalance
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 NativeBalance
impl Debug for NativeBalance
source§impl Default for NativeBalance
impl Default for NativeBalance
source§fn default() -> NativeBalance
fn default() -> NativeBalance
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for NativeBalance
impl<'de> Deserialize<'de> for NativeBalance
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 Display for NativeBalance
impl Display for NativeBalance
source§impl JsonSchema for NativeBalance
impl JsonSchema for NativeBalance
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl PartialEq for NativeBalance
impl PartialEq for NativeBalance
source§fn eq(&self, other: &NativeBalance) -> bool
fn eq(&self, other: &NativeBalance) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for NativeBalance
impl Serialize for NativeBalance
source§impl Sub<Coin> for NativeBalance
impl Sub<Coin> for NativeBalance
impl StructuralPartialEq for NativeBalance
Auto Trait Implementations§
impl RefUnwindSafe for NativeBalance
impl Send for NativeBalance
impl Sync for NativeBalance
impl Unpin for NativeBalance
impl UnwindSafe for NativeBalance
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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