diff --git a/src/util/amount.rs b/src/util/amount.rs index 13756844..82219b38 100644 --- a/src/util/amount.rs +++ b/src/util/amount.rs @@ -864,7 +864,7 @@ impl ::std::iter::Sum for SignedAmount { } /// Calculate the sum over the iterator using checked arithmetic. -pub trait CheckedSum { +pub trait CheckedSum: private::SumSeal { /// Calculate the sum over the iterator using checked arithmetic. If an over or underflow would /// happen it returns `None`. fn checked_sum(self) -> Option; @@ -892,6 +892,16 @@ impl CheckedSum for T where T: Iterator { } } +mod private { + use ::{Amount, SignedAmount}; + + /// Used to seal the `CheckedSum` trait + pub trait SumSeal {} + + impl SumSeal for T where T: Iterator {} + impl SumSeal for T where T: Iterator {} +} + #[cfg(feature = "serde")] pub mod serde { // methods are implementation of a standardized serde-specific signature