diff --git a/single_use_seals/src/lib.rs b/single_use_seals/src/lib.rs index 5615c59e..72b00e34 100644 --- a/single_use_seals/src/lib.rs +++ b/single_use_seals/src/lib.rs @@ -117,6 +117,24 @@ use core::error::Error; use core::fmt::{self, Debug, Display, Formatter}; use core::marker::PhantomData; +#[cfg(feature = "strict_encoding")] +use strict_encoding::{StrictDecode, StrictDumb, StrictEncode}; + +#[cfg(not(feature = "strict_encoding"))] +trait StrictDumb {} +#[cfg(not(feature = "strict_encoding"))] +impl StrictDumb for T {} + +#[cfg(not(feature = "strict_encoding"))] +trait StrictEncode {} +#[cfg(not(feature = "strict_encoding"))] +impl StrictEncode for T {} + +#[cfg(not(feature = "strict_encoding"))] +trait StrictDecode {} +#[cfg(not(feature = "strict_encoding"))] +impl StrictDecode for T {} + /// Trait for proof-of-publication medium on which the seals are defined, /// closed, verified and which can be used for convenience operations related to /// seals: @@ -135,25 +153,15 @@ use core::marker::PhantomData; /// /// To read more on proof-of-publication please check /// -pub trait SingleUseSeal: Clone + Debug + Display { +pub trait SingleUseSeal: + Clone + Debug + Display + StrictDumb + StrictEncode + StrictDecode +{ /// Message type that is supported by the current single-use-seal. type Message: Copy + Eq; - #[cfg(not(feature = "strict_encoding"))] - type PubWitness: PublishedWitness; - #[cfg(feature = "strict_encoding")] - type PubWitness: PublishedWitness - + strict_encoding::StrictDumb - + strict_encoding::StrictEncode - + strict_encoding::StrictDecode; + type PubWitness: PublishedWitness + StrictDumb + StrictEncode + StrictDecode; - #[cfg(not(feature = "strict_encoding"))] - type CliWitness: ClientSideWitness; - #[cfg(feature = "strict_encoding")] - type CliWitness: ClientSideWitness - + strict_encoding::StrictDumb - + strict_encoding::StrictEncode - + strict_encoding::StrictDecode; + type CliWitness: ClientSideWitness + StrictDumb + StrictEncode + StrictDecode; fn is_included(&self, message: Self::Message, witness: &SealWitness) -> bool; }