FeatureFlagsBuilder

Struct FeatureFlagsBuilder 

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

Builder for FeatureFlags

§Examples

Building flags for development environment:

use chie_shared::FeatureFlagsBuilder;

let flags = FeatureFlagsBuilder::new()
    .beta(true)
    .debug_mode(true)
    .performance_profiling(true)
    .enhanced_telemetry(true)
    .build();

assert!(flags.beta);
assert!(flags.debug_mode);
assert!(flags.has_diagnostic_features());

Building flags for staging environment:

use chie_shared::FeatureFlagsBuilder;

let flags = FeatureFlagsBuilder::new()
    .beta(true)
    .enhanced_telemetry(true)
    .compression_optimization(true)
    .adaptive_retry(true)
    .build();

assert!(flags.beta);
assert!(!flags.experimental);  // Not ready for experimental
assert!(flags.enhanced_telemetry);

Implementations§

Source§

impl FeatureFlagsBuilder

Source

pub fn new() -> Self

Create a new builder with default values

Source

pub const fn experimental(self, enable: bool) -> Self

Enable or disable experimental features

Source

pub const fn beta(self, enable: bool) -> Self

Enable or disable beta features

Source

pub const fn enhanced_telemetry(self, enable: bool) -> Self

Enable or disable enhanced telemetry

Source

pub const fn performance_profiling(self, enable: bool) -> Self

Enable or disable performance profiling

Source

pub const fn debug_mode(self, enable: bool) -> Self

Enable or disable debug mode

Source

pub const fn compression_optimization(self, enable: bool) -> Self

Enable or disable compression optimization

Source

pub const fn adaptive_retry(self, enable: bool) -> Self

Enable or disable adaptive retry

Source

pub const fn build(self) -> FeatureFlags

Build the feature flags configuration

Trait Implementations§

Source§

impl Debug for FeatureFlagsBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FeatureFlagsBuilder

Source§

fn default() -> FeatureFlagsBuilder

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