macro_rules! for_all_features { ($macro:ident) => { ... }; }
Expand description
Define all features that are available based on the tier of the license.
§Define a new feature
To add a new feature, add a new entry below following the same pattern as the existing ones.
Check the definition of Tier
for all available tiers. Note that normally there’s no need to
add a feature with the minimum tier of Free
, as you can directly write the code without
gating it with a feature check.
§Check the availability of a feature
To check the availability of a feature during runtime, call the method
check_available
on the feature. If the feature is not available,
an error of type FeatureNotAvailable
will be returned and you should handle it properly,
generally by returning an error to the user.
§Feature availability in tests
In tests with debug_assertions
enabled, a license key of the paid (maximum) tier is set by
default. As a result, all features are available in tests. To test the behavior when a feature
is not available, you can manually set a license key with a lower tier. Check the e2e test cases
under error_ui
for examples.