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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FeeRate
impl<'de> Deserialize<'de> for FeeRate
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FeeRate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FeeRate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Ord for FeeRate
impl Ord for FeeRate
Source§impl PartialOrd for FeeRate
impl PartialOrd for FeeRate
Source§impl Serialize for FeeRate
impl Serialize for FeeRate
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,
impl Copy for FeeRate
impl Eq for FeeRate
impl StructuralPartialEq for FeeRate
Auto Trait Implementations§
impl Freeze for FeeRate
impl RefUnwindSafe for FeeRate
impl Send for FeeRate
impl Sync for FeeRate
impl Unpin for FeeRate
impl UnwindSafe for FeeRate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)