pub struct PpmFeeRate(pub u64);Tuple Fields§
§0: u64Implementations§
Source§impl PpmFeeRate
impl PpmFeeRate
Sourcepub const ZERO: PpmFeeRate
pub const ZERO: PpmFeeRate
The zero amount.
Sourcepub const ONE_PERCENT: PpmFeeRate
pub const ONE_PERCENT: PpmFeeRate
Represents a fee rate of 1%.
Sourcepub fn checked_mul(self, other: Amount) -> Option<Amount>
pub fn checked_mul(self, other: Amount) -> Option<Amount>
Multiplies the given amount by this fee rate. Returns None if the result overflows.
Trait Implementations§
Source§impl Clone for PpmFeeRate
impl Clone for PpmFeeRate
Source§fn clone(&self) -> PpmFeeRate
fn clone(&self) -> PpmFeeRate
Returns a duplicate 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 PpmFeeRate
impl Debug for PpmFeeRate
Source§impl<'de> Deserialize<'de> for PpmFeeRate
impl<'de> Deserialize<'de> for PpmFeeRate
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 Hash for PpmFeeRate
impl Hash for PpmFeeRate
Source§impl Mul<PpmFeeRate> for Amount
impl Mul<PpmFeeRate> for Amount
Source§fn mul(self, ppm: PpmFeeRate) -> Self::Output
fn mul(self, ppm: PpmFeeRate) -> Self::Output
Calculates a fee value for the current amount using a parts-per-million (PPM) rate.
§Returns
Returns the calculated fee as an Amount. The result is truncated using integer division,
and any overflow is capped with u64::MAX.
§Example
use ark::fees::PpmFeeRate;
use bitcoin::Amount;
let fee_chargeable_amount = Amount::from_sat(10_000);
let ppm = PpmFeeRate(5_000); // 0.5%
let fee = fee_chargeable_amount * ppm;
assert_eq!(fee, Amount::from_sat(50)); // 10,000 * 5,000 / 1,000,000 = 50Source§impl Ord for PpmFeeRate
impl Ord for PpmFeeRate
Source§fn cmp(&self, other: &PpmFeeRate) -> Ordering
fn cmp(&self, other: &PpmFeeRate) -> 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 PpmFeeRate
impl PartialEq for PpmFeeRate
Source§impl PartialOrd for PpmFeeRate
impl PartialOrd for PpmFeeRate
Source§impl Serialize for PpmFeeRate
impl Serialize for PpmFeeRate
impl Copy for PpmFeeRate
impl Eq for PpmFeeRate
impl StructuralPartialEq for PpmFeeRate
Auto Trait Implementations§
impl Freeze for PpmFeeRate
impl RefUnwindSafe for PpmFeeRate
impl Send for PpmFeeRate
impl Sync for PpmFeeRate
impl Unpin for PpmFeeRate
impl UnsafeUnpin for PpmFeeRate
impl UnwindSafe for PpmFeeRate
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