pub trait FlagStore:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn get<'a>(
&'a self,
flag: &'a str,
scope: &'a Scope,
) -> BoxFuture<'a, Result<Option<bool>>>;
fn set<'a>(
&'a self,
flag: &'a str,
scope: &'a Scope,
value: bool,
) -> BoxFuture<'a, Result<()>>;
fn forget<'a>(
&'a self,
flag: &'a str,
scope: &'a Scope,
) -> BoxFuture<'a, Result<()>>;
fn flush(&self) -> BoxFuture<'_, Result<()>>;
}Expand description
Somewhere overrides are kept.
Every method is keyed by a (flag, scope) pair, and the store is free to
key its rows however it likes as long as Scope::key distinctions are
preserved — a user and a tenant with the same name are two subjects.
Required Methods§
Sourcefn get<'a>(
&'a self,
flag: &'a str,
scope: &'a Scope,
) -> BoxFuture<'a, Result<Option<bool>>>
fn get<'a>( &'a self, flag: &'a str, scope: &'a Scope, ) -> BoxFuture<'a, Result<Option<bool>>>
The override for one flag and scope: None when nobody has set one.
None and Some(false) are emphatically not the same answer. None
means “no opinion, ask the resolver”; Some(false) means “somebody
turned this off”. A store that collapses the two turns every override
into a suggestion.
Sourcefn set<'a>(
&'a self,
flag: &'a str,
scope: &'a Scope,
value: bool,
) -> BoxFuture<'a, Result<()>>
fn set<'a>( &'a self, flag: &'a str, scope: &'a Scope, value: bool, ) -> BoxFuture<'a, Result<()>>
Write an override, replacing any that was there.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".