units: Remove alloc from fee module
The fee module methods behind alloc perform only arithmetic operations, so they don't require heap allocation
This commit is contained in:
parent
9c3a52be88
commit
43a7c66f50
|
@ -33,7 +33,6 @@ impl Amount {
|
||||||
/// let fee_rate = amount.checked_div_by_weight_ceil(weight).expect("Division by weight failed");
|
/// let fee_rate = amount.checked_div_by_weight_ceil(weight).expect("Division by weight failed");
|
||||||
/// assert_eq!(fee_rate, FeeRate::from_sat_per_kwu(34));
|
/// assert_eq!(fee_rate, FeeRate::from_sat_per_kwu(34));
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(feature = "alloc")]
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn checked_div_by_weight_ceil(self, weight: Weight) -> Option<FeeRate> {
|
pub const fn checked_div_by_weight_ceil(self, weight: Weight) -> Option<FeeRate> {
|
||||||
let wu = weight.to_wu();
|
let wu = weight.to_wu();
|
||||||
|
@ -56,7 +55,6 @@ impl Amount {
|
||||||
/// can be made. See also [`Self::checked_div_by_weight_ceil`].
|
/// can be made. See also [`Self::checked_div_by_weight_ceil`].
|
||||||
///
|
///
|
||||||
/// Returns [`None`] if overflow occurred.
|
/// Returns [`None`] if overflow occurred.
|
||||||
#[cfg(feature = "alloc")]
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn checked_div_by_weight_floor(self, weight: Weight) -> Option<FeeRate> {
|
pub const fn checked_div_by_weight_floor(self, weight: Weight) -> Option<FeeRate> {
|
||||||
// No `?` operator in const context.
|
// No `?` operator in const context.
|
||||||
|
|
Loading…
Reference in New Issue