[−][src]Struct bullettrain::Client
Provides various methods to interact with BulletTrain API.
Static method new can be used to create instance configured with default API address. To use custom API address, use struct constructor.
Example
let client = bullettrain::Client { api_key: String::from("secret key"), base_uri: String::from("https://features.on.my.own.server/api/v1/"), };
Fields
api_key: String
base_uri: String
Implementations
impl Client
[src]
pub fn new(api_key: &str) -> Client
[src]
Returns Client instance configured to use default API address and given API key.
pub fn get_features(&self) -> Result<Vec<Flag>, Error>
[src]
Returns all features available in given environment.
pub fn get_user_features(&self, user: &User) -> Result<Vec<Flag>, Error>
[src]
Returns all features as defined for given user.
pub fn has_feature(&self, name: &str) -> Result<bool, Error>
[src]
Returns information whether given feature is defined.
pub fn has_user_feature(&self, user: &User, name: &str) -> Result<bool, Error>
[src]
Returns information whether given feature is defined for given user.
pub fn feature_enabled(&self, name: &str) -> Result<bool, Error>
[src]
Returns information whether given feature flag is enabled.
pub fn user_feature_enabled(
&self,
user: &User,
name: &str
) -> Result<bool, Error>
[src]
&self,
user: &User,
name: &str
) -> Result<bool, Error>
Returns information whether given feature flag is enabled for given user.
pub fn get_value(&self, name: &str) -> Result<Option<Value>, Error>
[src]
Returns value of given feature (remote config).
Returned value can have one of following types: boolean, integer, string.
pub fn get_user_value(
&self,
user: &User,
name: &str
) -> Result<Option<Value>, Error>
[src]
&self,
user: &User,
name: &str
) -> Result<Option<Value>, Error>
Returns value of given feature (remote config) as defined for given user.
Returned value can have one of following types: boolean, integer, string.
pub fn get_trait(&self, user: &User, key: &str) -> Result<Trait, Error>
[src]
Returns trait defined for given user.
pub fn get_traits(
&self,
user: &User,
keys: Vec<&str>
) -> Result<Vec<Trait>, Error>
[src]
&self,
user: &User,
keys: Vec<&str>
) -> Result<Vec<Trait>, Error>
Returns all traits defined for given user.
If keys are provided, get_traits returns only corresponding traits, otherwise all traits for given user are returned.
pub fn update_trait(
&self,
user: &User,
to_update: &Trait
) -> Result<Trait, Error>
[src]
&self,
user: &User,
to_update: &Trait
) -> Result<Trait, Error>
Updates trait value for given user, returns updated trait.
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,