plutus_ledger_api/feature_traits.rs
1//! Traits that are only implemented when a feature flag is enabled.
2#[cfg(feature = "lbf")]
3use lbr_prelude::json::Json;
4
5/// FeatureTraits is an intermediate trait which inherits different traits depending on the
6/// compilation feature flag. This makes it cleaner to implement structs with generics, with
7/// optional trait bounds.
8#[cfg(feature = "lbf")]
9pub trait FeatureTraits: Json {}
10#[cfg(feature = "lbf")]
11impl<T> FeatureTraits for T where T: Json {}
12
13#[cfg(not(feature = "lbf"))]
14pub trait FeatureTraits {}
15#[cfg(not(feature = "lbf"))]
16impl<T> FeatureTraits for T {}