pub struct FeeRate(_);Expand description
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§
§impl FeeRate
impl FeeRate
pub const ZERO: FeeRate = FeeRate(0)
pub const ZERO: FeeRate = FeeRate(0)
0 sat/kwu.
Equivalent to MIN, may better express intent in some contexts.
pub const MIN: FeeRate = FeeRate(u64::min_value())
pub const MIN: FeeRate = FeeRate(u64::min_value())
Minimum possible value (0 sat/kwu).
Equivalent to ZERO, may better express intent in some contexts.
pub const BROADCAST_MIN: FeeRate = FeeRate::from_sat_per_vb_unchecked(1)
pub const BROADCAST_MIN: FeeRate = FeeRate::from_sat_per_vb_unchecked(1)
Minimum fee rate required to broadcast a transaction.
The value matches the default Bitcoin Core policy at the time of library release.
pub const DUST: FeeRate = FeeRate::from_sat_per_vb_unchecked(3)
pub const DUST: FeeRate = FeeRate::from_sat_per_vb_unchecked(3)
Fee rate used to compute dust amount.
pub 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.
pub fn from_sat_per_vb(sat_vb: u64) -> Option<FeeRate>
pub fn from_sat_per_vb(sat_vb: u64) -> Option<FeeRate>
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
Trait Implementations§
§impl Ord for FeeRate
impl Ord for FeeRate
§impl PartialOrd<FeeRate> for FeeRate
impl PartialOrd<FeeRate> for FeeRate
§fn partial_cmp(&self, other: &FeeRate) -> Option<Ordering>
fn partial_cmp(&self, other: &FeeRate) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Copy for FeeRate
impl Eq for FeeRate
impl StructuralEq for FeeRate
impl StructuralPartialEq for FeeRate
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.