pub struct FeeRate(/* private fields */);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§
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) -> Self
pub const fn from_sat_per_kwu(sat_kwu: u64) -> Self
Constructs FeeRate from satoshis per 1000 weight units.
Sourcepub fn from_sat_per_vb(sat_vb: u64) -> Option<Self>
pub fn from_sat_per_vb(sat_vb: u64) -> Option<Self>
Sourcepub const fn from_sat_per_vb_u32(sat_vb: u32) -> Self
pub const fn from_sat_per_vb_u32(sat_vb: u32) -> Self
Constructs a new FeeRate from satoshis per virtual bytes.
Sourcepub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> Self
👎Deprecated since 0.32.7: use from_sat_per_vb_u32 instead
pub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> Self
use from_sat_per_vb_u32 instead
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<Self>
pub fn checked_mul(self, rhs: u64) -> Option<Self>
Checked multiplication.
Computes self * rhs returning None if overflow occurred.
Sourcepub fn checked_div(self, rhs: u64) -> Option<Self>
pub fn checked_div(self, rhs: u64) -> Option<Self>
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<'a> Arbitrary<'a> for FeeRate
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for FeeRate
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read more