pub struct OpenFeature { /* private fields */ }
Expand description
THE struct of the OpenFeature API.
Access it via the [SINGLETON
] instance.
Implementations§
Source§impl OpenFeature
impl OpenFeature
Sourcepub async fn singleton() -> RwLockReadGuard<'static, Self>
pub async fn singleton() -> RwLockReadGuard<'static, Self>
Get the singleton of OpenFeature
.
Sourcepub async fn singleton_mut() -> RwLockWriteGuard<'static, Self>
pub async fn singleton_mut() -> RwLockWriteGuard<'static, Self>
Get a mutable singleton of OpenFeature
.
Sourcepub async fn set_evaluation_context(
&mut self,
evaluation_context: EvaluationContext,
)
pub async fn set_evaluation_context( &mut self, evaluation_context: EvaluationContext, )
Set the global evaluation context.
Sourcepub async fn set_provider<T: FeatureProvider>(&mut self, provider: T)
pub async fn set_provider<T: FeatureProvider>(&mut self, provider: T)
Set the default provider.
Sourcepub async fn set_named_provider<T: FeatureProvider>(
&mut self,
name: &str,
provider: T,
)
pub async fn set_named_provider<T: FeatureProvider>( &mut self, name: &str, provider: T, )
Bind the given provider
to the corresponding name
.
Sourcepub async fn provider_metadata(&self) -> ProviderMetadata
pub async fn provider_metadata(&self) -> ProviderMetadata
Return the metadata of default (unnamed) provider.
Sourcepub async fn named_provider_metadata(
&self,
name: &str,
) -> Option<ProviderMetadata>
pub async fn named_provider_metadata( &self, name: &str, ) -> Option<ProviderMetadata>
Return the metadata of named provider (a provider bound to clients with this name).
Sourcepub fn create_client(&self) -> Client
pub fn create_client(&self) -> Client
Create a new client with default name.
Sourcepub fn create_named_client(&self, name: &str) -> Client
pub fn create_named_client(&self, name: &str) -> Client
Create a new client with specific name
.
It will use the provider bound to this name, if any.
Trait Implementations§
Source§impl Default for OpenFeature
impl Default for OpenFeature
Source§fn default() -> OpenFeature
fn default() -> OpenFeature
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OpenFeature
impl !RefUnwindSafe for OpenFeature
impl Send for OpenFeature
impl Sync for OpenFeature
impl Unpin for OpenFeature
impl !UnwindSafe for OpenFeature
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