Struct FeeRate
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§
§impl FeeRate
impl FeeRate
pub const ZERO: FeeRate = _
pub const ZERO: FeeRate = _
0 sat/kwu.
Equivalent to MIN
, may better express intent in some contexts.
pub 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.
pub 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.
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
.
pub 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§
§impl<'de> Deserialize<'de> for FeeRate
impl<'de> Deserialize<'de> for FeeRate
§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>,
§impl Ord for FeeRate
impl Ord for FeeRate
§impl PartialOrd for FeeRate
impl PartialOrd for FeeRate
§impl Serialize for FeeRate
impl Serialize for FeeRate
§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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request