Features
About
features
is a small library that implements runtime feature toggles for
your library or program allowing behavior to be changed on boot or dynamically at runtime using
the same compiled binary artifact. This is different from cargo's feature
support which uses conditional compilation.
At its core, it is a macro (features!
) that takes a collection of feature flag names which it
uses to generate a module containing a function to enable a feature toggle (::enable()
), a
function to disable a feature toggle (::disable()
) and a function to check if a feature
toggle is enabled (::is_enabled()
).
Example
Basic example:
extern crate bitflags;
extern crate features;
features!
Multiple feature sets:
extern crate bitflags;
extern crate features;
features!
features!
Feature Toggle References
Here are some articles and projects which insipred the implementation of features
:
- Feature Toggles (Martin Fowler's blog)
- Using Feature Flags to Ship Changes with Confidence (TravisCI's blog)
- Feature Toggles are one of the worst kinds of Technical Debt (excellent cautionary tale and warning)
- Feature toggle (Wikipedia article)
- Ruby feature gem (nice prior art)
License
Features is licensed under the Apache License, Version 2.0 and the MIT license. Please read the LICENSE-APACHE and LICENSE-MIT for details