pub trait FeaturesModule: Sized + ContractBase {
// Required methods
fn get_feature_flag(&self, feature_name: FeatureName<'_>) -> u8;
fn set_feature_flag(&self, feature_name: FeatureName<'_>, value: u8);
// Provided methods
fn check_feature_on(&self, feature_name: &'static [u8], default: bool) { ... }
fn set_feature_flag_endpoint(
&self,
feature_name: Vec<u8>,
value: bool,
) -> SCResult<()> { ... }
}Expand description
This is a standard smart contract module, that when added to a smart contract offers feature flag capabilities.
It offers:
- an endpoint where the owner can turn features on/off
- a method to check if feature is on or not
- a macro to make calling this method even more compact
Required Methods§
fn get_feature_flag(&self, feature_name: FeatureName<'_>) -> u8
fn set_feature_flag(&self, feature_name: FeatureName<'_>, value: u8)
Provided Methods§
fn check_feature_on(&self, feature_name: &'static [u8], default: bool)
fn set_feature_flag_endpoint( &self, feature_name: Vec<u8>, value: bool, ) -> SCResult<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.