Add private::Sealed trait bound to SerdeAmount

As suggested by the todo seal the `SerdeAmount` so users of the library
explicitly cannot implement it.

Its not obvious to me why this wasn't done at the time.

Remove the associated TODO from the code.
This commit is contained in:
Tobin C. Harding 2022-09-01 16:52:29 +10:00
parent 08e4b28dd0
commit fea908c8af
1 changed files with 1 additions and 3 deletions

View File

@ -1281,9 +1281,7 @@ pub mod serde {
/// This trait is used only to avoid code duplication and naming collisions
/// of the different serde serialization crates.
///
/// TODO: Add the private::Sealed bound in next breaking release
pub trait SerdeAmount: Copy + Sized {
pub trait SerdeAmount: Copy + Sized + private::Sealed {
fn ser_sat<S: Serializer>(self, s: S) -> Result<S::Ok, S::Error>;
fn des_sat<'d, D: Deserializer<'d>>(d: D) -> Result<Self, D::Error>;
fn ser_btc<S: Serializer>(self, s: S) -> Result<S::Ok, S::Error>;