multiversx_sc_modules::features

Trait FeaturesModule

Source
pub trait FeaturesModule: ContractBase + Sized {
    // Required method
    fn feature_flag(
        &self,
        feature_name: &FeatureName<Self::Api>,
    ) -> SingleValueMapper<Self::Api, u8>;

    // Provided methods
    fn check_feature_on(&self, feature_name: &'static [u8], default: bool) { ... }
    fn set_feature_flag_endpoint(
        &self,
        feature_name: ManagedBuffer<Self::Api>,
        value: bool,
    ) { ... }
}
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§

Source

fn feature_flag( &self, feature_name: &FeatureName<Self::Api>, ) -> SingleValueMapper<Self::Api, u8>

Provided Methods§

Source

fn check_feature_on(&self, feature_name: &'static [u8], default: bool)

Source

fn set_feature_flag_endpoint( &self, feature_name: ManagedBuffer<Self::Api>, value: bool, )

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.

Implementors§

Source§

impl<C> FeaturesModule for C
where C: AutoImpl,