Struct OpenFeature

Source
pub struct OpenFeature { /* private fields */ }
Expand description

THE struct of the OpenFeature API. Access it via the [SINGLETON] instance.

Implementations§

Source§

impl OpenFeature

Source

pub async fn singleton() -> RwLockReadGuard<'static, Self>

Get the singleton of OpenFeature.

Source

pub async fn singleton_mut() -> RwLockWriteGuard<'static, Self>

Get a mutable singleton of OpenFeature.

Source

pub async fn set_evaluation_context( &mut self, evaluation_context: EvaluationContext, )

Set the global evaluation context.

Source

pub async fn set_provider<T: FeatureProvider>(&mut self, provider: T)

Set the default provider.

Source

pub async fn set_named_provider<T: FeatureProvider>( &mut self, name: &str, provider: T, )

Bind the given provider to the corresponding name.

Source

pub async fn add_hook<T: Hook>(&mut self, hook: T)

Add a new hook to the global list of hooks.

Source

pub async fn provider_metadata(&self) -> ProviderMetadata

Return the metadata of default (unnamed) provider.

Source

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).

Source

pub fn create_client(&self) -> Client

Create a new client with default name.

Source

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.

Source

pub async fn shutdown(&mut self)

Drops all the registered providers.

Trait Implementations§

Source§

impl Default for OpenFeature

Source§

fn default() -> OpenFeature

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.