Skip to content

Commit

Permalink
Merge rust-bitcoin#3725: Rename private module to sealed
Browse files Browse the repository at this point in the history
7725ca7 Rename private module to sealed (Tobin C. Harding)

Pull request description:

  There are two `private` modules in `amount` but they do slightly different things. One provides a private `Token` and one is for trait sealing. We have various other trait sealing modules in the codebase and they are all called `sealed` not `private`. Also the seal trait is called `Sealed`.

  Rename the `private` module and the trait to be uniform with the rest of the codebase.

ACKs for top commit:
  apoelstra:
    ACK 7725ca7; successfully ran local tests; sure

Tree-SHA512: 5953686d7d22daaad8d2d59eff2338db3bb2a7765a37c08ed02ae1a4622509d628dbcb971781a6e85d750afa58609f5b058dfce6d5b4066f4f0d8ded45375b5b
  • Loading branch information
apoelstra committed Dec 12, 2024
2 parents 6865ced + 7725ca7 commit ea6bf12
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions units/src/amount/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ enum DisplayStyle {
}

/// Calculates the sum over the iterator using checked arithmetic.
pub trait CheckedSum<R>: private::SumSeal<R> {
pub trait CheckedSum<R>: sealed::Sealed<R> {
/// Calculates the sum over the iterator using checked arithmetic. If an over or underflow would
/// happen it returns [`None`].
fn checked_sum(self) -> Option<R>;
Expand Down Expand Up @@ -591,12 +591,12 @@ where
}
}

mod private {
mod sealed {
use super::{Amount, SignedAmount};

/// Used to seal the `CheckedSum` trait
pub trait SumSeal<A> {}
pub trait Sealed<A> {}

impl<T> SumSeal<Amount> for T where T: Iterator<Item = Amount> {}
impl<T> SumSeal<SignedAmount> for T where T: Iterator<Item = SignedAmount> {}
impl<T> Sealed<Amount> for T where T: Iterator<Item = Amount> {}
impl<T> Sealed<SignedAmount> for T where T: Iterator<Item = SignedAmount> {}
}

0 comments on commit ea6bf12

Please sign in to comment.