plutus_ledger_api/
feature_traits.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Traits that are only implemented when a feature flag is enabled.
#[cfg(feature = "lbf")]
use lbr_prelude::json::Json;

/// FeatureTraits is an intermediate trait which inherits different traits depending on the
/// compilation feature flag. This makes it cleaner to implement structs with generics, with
/// optional trait bounds.
#[cfg(feature = "lbf")]
pub trait FeatureTraits: Json {}
#[cfg(feature = "lbf")]
impl<T> FeatureTraits for T where T: Json {}

#[cfg(not(feature = "lbf"))]
pub trait FeatureTraits {}
#[cfg(not(feature = "lbf"))]
impl<T> FeatureTraits for T {}