pub struct FeeRate(/* private fields */);
Expand description
Re-export everything from the units::fee_rate
module.
Represents fee rate.
This is an integer newtype representing fee rate in sat/kwu
. It provides protection against mixing
up the types as well as basic formatting features.
Implementations§
Source§impl FeeRate
impl FeeRate
Sourcepub const ZERO: FeeRate
pub const ZERO: FeeRate
0 sat/kwu.
Equivalent to MIN
, may better express intent in some contexts.
Sourcepub const MIN: FeeRate = FeeRate::ZERO
pub const MIN: FeeRate = FeeRate::ZERO
Minimum possible value (0 sat/kwu).
Equivalent to ZERO
, may better express intent in some contexts.
Sourcepub const BROADCAST_MIN: FeeRate
pub const BROADCAST_MIN: FeeRate
Minimum fee rate required to broadcast a transaction.
The value matches the default Bitcoin Core policy at the time of library release.
Sourcepub const fn from_sat_per_kwu(sat_kwu: u64) -> FeeRate
pub const fn from_sat_per_kwu(sat_kwu: u64) -> FeeRate
Constructs FeeRate
from satoshis per 1000 weight units.
Sourcepub fn from_sat_per_vb(sat_vb: u64) -> Option<FeeRate>
pub fn from_sat_per_vb(sat_vb: u64) -> Option<FeeRate>
Sourcepub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> FeeRate
pub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> FeeRate
Constructs FeeRate
from satoshis per virtual bytes without overflow check.
Sourcepub const fn to_sat_per_kwu(self) -> u64
pub const fn to_sat_per_kwu(self) -> u64
Returns raw fee rate.
Can be used instead of into()
to avoid inference issues.
Sourcepub const fn to_sat_per_vb_floor(self) -> u64
pub const fn to_sat_per_vb_floor(self) -> u64
Converts to sat/vB rounding down.
Sourcepub const fn to_sat_per_vb_ceil(self) -> u64
pub const fn to_sat_per_vb_ceil(self) -> u64
Converts to sat/vB rounding up.
Sourcepub fn checked_mul(self, rhs: u64) -> Option<FeeRate>
pub fn checked_mul(self, rhs: u64) -> Option<FeeRate>
Checked multiplication.
Computes self * rhs
returning None
if overflow occurred.
Sourcepub fn checked_div(self, rhs: u64) -> Option<FeeRate>
pub fn checked_div(self, rhs: u64) -> Option<FeeRate>
Checked division.
Computes self / rhs
returning None
if rhs == 0
.
Sourcepub fn checked_mul_by_weight(self, rhs: Weight) -> Option<Amount>
pub fn checked_mul_by_weight(self, rhs: Weight) -> Option<Amount>
Checked weight multiplication.
Computes the absolute fee amount for a given Weight
at this fee rate.
None
is returned if an overflow occurred.