[][src]Struct unleash_api_client::client::Client

pub struct Client<C, F> where
    C: HttpClient,
    F: Enum<CachedFeature> + Debug + DeserializeOwned + Serialize
{ /* fields omitted */ }

Implementations

impl<C, F> Client<C, F> where
    C: HttpClient + Default,
    F: Enum<CachedFeature> + Clone + Debug + DeserializeOwned + Serialize
[src]

pub fn is_enabled(
    &self,
    feature_enum: F,
    context: Option<&Context>,
    default: bool
) -> bool
[src]

pub fn is_enabled_str(
    &self,
    feature_name: &str,
    context: Option<&Context>,
    default: bool
) -> bool
[src]

pub fn memoize(
    &self,
    features: Vec<Feature>
) -> Result<Option<Metrics>, Box<dyn Error>>
[src]

Memoize new features into the cached state

Interior mutability is used, via the arc-swap crate.

Note that this is primarily public to facilitate benchmarking; poll_for_updates is the usual way in which memoize will be called.

pub async fn poll_for_updates<'_>(&'_ self)[src]

Query the API endpoint for features and push metrics

Immediately and then every self.interval milliseconds the API server is queryed for features and the previous cycles metrics are uploaded.

May be dropped, or will terminate at the next polling cycle after stop_poll is called().

pub async fn register<'_>(
    &'_ self
) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
[src]

Register this client with the API endpoint.

pub async fn stop_poll<'_>(&'_ self)[src]

stop the poll_for_updates() function.

If poll is not running, will wait-loop until poll_for_updates is running, then signal it to stop, then return. Will wait for ever if poll_for_updates never starts running.

Auto Trait Implementations

impl<C, F> !RefUnwindSafe for Client<C, F>

impl<C, F> Send for Client<C, F> where
    <F as Enum<CachedFeature>>::Array: Send + Sync

impl<C, F> Sync for Client<C, F> where
    <F as Enum<CachedFeature>>::Array: Send + Sync

impl<C, F> Unpin for Client<C, F>

impl<C, F> !UnwindSafe for Client<C, F>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]