pub struct Amount(/* private fields */);
Expand description
Amount can be any unit
Implementations§
Source§impl Amount
impl Amount
Sourcepub fn split_targeted(&self, target: &SplitTarget) -> Result<Vec<Amount>, Error>
pub fn split_targeted(&self, target: &SplitTarget) -> Result<Vec<Amount>, Error>
Split into parts that are powers of two by target
Sourcepub fn split_with_fee(&self, fee_ppk: u64) -> Result<Vec<Amount>, Error>
pub fn split_with_fee(&self, fee_ppk: u64) -> Result<Vec<Amount>, Error>
Splits amount into powers of two while accounting for the swap fee
Sourcepub fn checked_add(self, other: Amount) -> Option<Amount>
pub fn checked_add(self, other: Amount) -> Option<Amount>
Checked addition for Amount. Returns None if overflow occurs.
Sourcepub fn checked_sub(self, other: Amount) -> Option<Amount>
pub fn checked_sub(self, other: Amount) -> Option<Amount>
Checked subtraction for Amount. Returns None if overflow occurs.
Sourcepub fn checked_mul(self, other: Amount) -> Option<Amount>
pub fn checked_mul(self, other: Amount) -> Option<Amount>
Checked multiplication for Amount. Returns None if overflow occurs.
Sourcepub fn checked_div(self, other: Amount) -> Option<Amount>
pub fn checked_div(self, other: Amount) -> Option<Amount>
Checked division for Amount. Returns None if overflow occurs.
Trait Implementations§
Source§impl AddAssign for Amount
impl AddAssign for Amount
Source§fn add_assign(&mut self, rhs: Amount)
fn add_assign(&mut self, rhs: Amount)
Performs the
+=
operation. Read moreSource§impl<'de> Deserialize<'de> for Amount
impl<'de> Deserialize<'de> for Amount
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Amount, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Amount, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Amount
impl Ord for Amount
Source§impl PartialOrd for Amount
impl PartialOrd for Amount
Source§impl Serialize for Amount
impl Serialize for Amount
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 SubAssign for Amount
impl SubAssign for Amount
Source§fn sub_assign(&mut self, other: Amount)
fn sub_assign(&mut self, other: Amount)
Performs the
-=
operation. Read moreimpl Copy for Amount
impl Eq for Amount
impl StructuralPartialEq for Amount
Auto Trait Implementations§
impl Freeze for Amount
impl RefUnwindSafe for Amount
impl Send for Amount
impl Sync for Amount
impl Unpin for Amount
impl UnwindSafe for Amount
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