Struct nakamoto_p2p::fsm::fees::FeeEstimate
source · Expand description
Fee rate estimate for a single block. Measured in satoshis/vByte.
Fields
low: FeeRate
The lowest fee rate included in the block.
median: FeeRate
The median fee rate of the block.
high: FeeRate
The highest fee rate included in the block.
Implementations
sourceimpl FeeEstimate
impl FeeEstimate
sourcepub fn from(fees: Vec<FeeRate>) -> Option<Self>
pub fn from(fees: Vec<FeeRate>) -> Option<Self>
Calculate a fee estimate from a list of fees.
Returns None
if the list is empty.
use nakamoto_p2p::fsm::fees::FeeEstimate;
assert_eq!(
FeeEstimate::from(vec![3, 9, 2]),
Some(FeeEstimate { low: 2, median: 3, high: 9 }),
);
assert_eq!(
FeeEstimate::from(vec![4, 6]),
Some(FeeEstimate { low: 4, median: 5, high: 6 }),
);
assert_eq!(
FeeEstimate::from(vec![9, 2, 1, 7]),
Some(FeeEstimate { low: 1, median: 5, high: 9 }),
);
assert_eq!(
FeeEstimate::from(vec![3]),
Some(FeeEstimate { low: 3, median: 3, high: 3 }),
);
assert_eq!(FeeEstimate::from(vec![]), None);
Trait Implementations
sourceimpl Clone for FeeEstimate
impl Clone for FeeEstimate
sourcefn clone(&self) -> FeeEstimate
fn clone(&self) -> FeeEstimate
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for FeeEstimate
impl Debug for FeeEstimate
sourceimpl PartialEq<FeeEstimate> for FeeEstimate
impl PartialEq<FeeEstimate> for FeeEstimate
sourcefn eq(&self, other: &FeeEstimate) -> bool
fn eq(&self, other: &FeeEstimate) -> bool
impl Eq for FeeEstimate
impl StructuralEq for FeeEstimate
impl StructuralPartialEq for FeeEstimate
Auto Trait Implementations
impl RefUnwindSafe for FeeEstimate
impl Send for FeeEstimate
impl Sync for FeeEstimate
impl Unpin for FeeEstimate
impl UnwindSafe for FeeEstimate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more