Merge rust-bitcoin/rust-bitcoin#4320: units: Do trivial docs fixes
da69e636a9
units: Use 100 column width in rustdoc comments (Tobin C. Harding)53c6ae4d40
units: Remove expect from rustdoc example (Tobin C. Harding) Pull request description: A couple of quick docs fixes while trying to polish `units`. ACKs for top commit: apoelstra: ACK da69e636a9d21e602289062279ed5ebc6b1429b6; successfully ran local tests Tree-SHA512: acfbec90b0327850b882c5e1b1e7eaadbf0a09a30dcc46529386ea419ed74846a678a5980f5706f8d280f30ec6f6d06af2db8f0e1748523b15ad47a654caee4b
This commit is contained in:
commit
c5b1b31963
|
@ -30,8 +30,8 @@ impl Amount {
|
|||
/// # use bitcoin_units::{amount, Amount, FeeRate, Weight};
|
||||
/// let amount = Amount::from_sat(10)?;
|
||||
/// let weight = Weight::from_wu(300);
|
||||
/// 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));
|
||||
/// let fee_rate = amount.checked_div_by_weight_ceil(weight);
|
||||
/// assert_eq!(fee_rate, Some(FeeRate::from_sat_per_kwu(34)));
|
||||
/// # Ok::<_, amount::OutOfRangeError>(())
|
||||
/// ```
|
||||
#[must_use]
|
||||
|
@ -140,10 +140,9 @@ impl FeeRate {
|
|||
|
||||
/// Checked weight multiplication.
|
||||
///
|
||||
/// Computes the absolute fee amount for a given [`Weight`] at this fee rate.
|
||||
/// When the resulting fee is a non-integer amount, the amount is rounded up,
|
||||
/// ensuring that the transaction fee is enough instead of falling short if
|
||||
/// rounded down.
|
||||
/// Computes the absolute fee amount for a given [`Weight`] at this fee rate. When the resulting
|
||||
/// fee is a non-integer amount, the amount is rounded up, ensuring that the transaction fee is
|
||||
/// enough instead of falling short if rounded down.
|
||||
///
|
||||
/// Returns [`None`] if overflow occurred.
|
||||
#[must_use]
|
||||
|
@ -197,10 +196,9 @@ crate::internal_macros::impl_op_for_references! {
|
|||
impl Weight {
|
||||
/// Checked fee rate multiplication.
|
||||
///
|
||||
/// Computes the absolute fee amount for a given [`FeeRate`] at this weight.
|
||||
/// When the resulting fee is a non-integer amount, the amount is rounded up,
|
||||
/// ensuring that the transaction fee is enough instead of falling short if
|
||||
/// rounded down.
|
||||
/// Computes the absolute fee amount for a given [`FeeRate`] at this weight. When the resulting
|
||||
/// fee is a non-integer amount, the amount is rounded up, ensuring that the transaction fee is
|
||||
/// enough instead of falling short if rounded down.
|
||||
///
|
||||
/// Returns [`None`] if overflow occurred.
|
||||
#[must_use]
|
||||
|
|
|
@ -12,8 +12,8 @@ use arbitrary::{Arbitrary, Unstructured};
|
|||
|
||||
/// 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.
|
||||
/// 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.
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
pub struct FeeRate(u64);
|
||||
|
||||
|
|
Loading…
Reference in New Issue