pub struct DynamicFeatures { /* private fields */ }Expand description
A dynamic feature flag store for cases where compile-time flags aren’t needed
Use this when you want to define flags at runtime or load them from configuration.
§Example
use tui_dispatch_core::DynamicFeatures;
let mut features = DynamicFeatures::new();
features.register("dark_mode", true);
features.register("experimental", false);
assert!(features.get("dark_mode"));
assert!(!features.get("experimental"));
features.toggle("experimental");
assert!(features.get("experimental"));Implementations§
Source§impl DynamicFeatures
impl DynamicFeatures
Sourcepub fn register(&mut self, name: impl Into<String>, default: bool)
pub fn register(&mut self, name: impl Into<String>, default: bool)
Register a new feature with a default value
Sourcepub fn flag_names(&self) -> impl Iterator<Item = &str>
pub fn flag_names(&self) -> impl Iterator<Item = &str>
Get all registered flag names
Trait Implementations§
Source§impl Clone for DynamicFeatures
impl Clone for DynamicFeatures
Source§fn clone(&self) -> DynamicFeatures
fn clone(&self) -> DynamicFeatures
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DynamicFeatures
impl Debug for DynamicFeatures
Source§impl Default for DynamicFeatures
impl Default for DynamicFeatures
Source§fn default() -> DynamicFeatures
fn default() -> DynamicFeatures
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DynamicFeatures
impl RefUnwindSafe for DynamicFeatures
impl Send for DynamicFeatures
impl Sync for DynamicFeatures
impl Unpin for DynamicFeatures
impl UnwindSafe for DynamicFeatures
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more