pub struct FeatureChecker { /* private fields */ }Implementations§
Source§impl FeatureChecker
impl FeatureChecker
pub fn new(namespace: String, options: &'static Options) -> Self
Sourcepub fn has(&self, feature_name: &str, context: &FeatureContext) -> bool
pub fn has(&self, feature_name: &str, context: &FeatureContext) -> bool
Check whether a feature flag is enabled for a given context.
Returns false if the feature is not defined, not enabled, conditions don’t match, or options have not been initialized.
Sourcepub fn try_has(
&self,
feature_name: &str,
context: &FeatureContext,
) -> Result<Option<bool>, FeatureError>
pub fn try_has( &self, feature_name: &str, context: &FeatureContext, ) -> Result<Option<bool>, FeatureError>
Like has, but distinguishes a feature that evaluated to false
from one that could not be evaluated at all.
Ok(Some(bool))– evaluated: disabled, no matching segment, or matchedOk(None)– no value set for this feature, so there was nothing to evaluateErr(_)– evaluation failed: seeFeatureError
Prefer has on hot paths.
Auto Trait Implementations§
impl !RefUnwindSafe for FeatureChecker
impl !UnwindSafe for FeatureChecker
impl Freeze for FeatureChecker
impl Send for FeatureChecker
impl Sync for FeatureChecker
impl Unpin for FeatureChecker
impl UnsafeUnpin for FeatureChecker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more