Struct launchdarkly_server_sdk::Flag

source ·
pub struct Flag {
    pub key: String,
    pub version: u64,
    pub track_events: bool,
    pub track_events_fallthrough: bool,
    pub debug_events_until_date: Option<u64>,
    /* private fields */
}
Expand description

Flag describes an individual feature flag.

Fields§

§key: String

The unique string key of the feature flag.

§version: u64

Version is an integer that is incremented by LaunchDarkly every time the configuration of the flag is changed.

§track_events: bool

Used internally by the SDK analytics event system.

This field is true if the current LaunchDarkly account has data export enabled, and has turned on the “send detailed event information for this flag” option for this flag. This tells the SDK to send full event data for each flag evaluation, rather than only aggregate data in a summary event.

The launchdarkly-server-sdk-evaluation crate does not implement that behavior; it is only in the data model for use by the SDK.

§track_events_fallthrough: bool

Used internally by the SDK analytics event system.

This field is true if the current LaunchDarkly account has experimentation enabled, has associated this flag with an experiment, and has enabled “default rule” for the experiment. This tells the SDK to send full event data for any evaluation where this flag had targeting turned on but the context did not match any targets or rules.

The launchdarkly-server-sdk-evaluation package does not implement that behavior; it is only in the data model for use by the SDK.

§debug_events_until_date: Option<u64>

Used internally by the SDK analytics event system.

This field is non-zero if debugging for this flag has been turned on temporarily in the LaunchDarkly dashboard. Debugging always is for a limited time, so the field specifies a Unix millisecond timestamp when this mode should expire. Until then, the SDK will send full event data for each evaluation of this flag.

The launchdarkly-server-sdk-evaluation package does not implement that behavior; it is only in the data model for use by the SDK.

Implementations§

source§

impl Flag

source

pub fn variation(&self, index: isize, reason: Reason) -> Detail<&FlagValue>

Generate a crate::Detail response with the given variation and reason.

source

pub fn off_value(&self, reason: Reason) -> Detail<&FlagValue>

Generate a crate::Detail response using the flag’s off variation.

If a flag has an off_variation specified, a crate::Detail will be created using that variation. If the flag does not have an off_variation specified, an empty crate::Detail will be returned. See crate::Detail::empty.

source

pub fn using_environment_id(&self) -> bool

Indicates that this flag is available to clients using the environment id to identify an environment (includes client-side javascript clients).

source

pub fn using_mobile_key(&self) -> bool

Indicates that this flag is available to clients using the mobile key for authorization (includes most desktop and mobile clients).

source

pub fn is_experimentation_enabled(&self, reason: &Reason) -> bool

Returns true if, based on the crate::Reason returned by the flag evaluation, an event for that evaluation should have full tracking enabled and always report the reason even if the application didn’t explicitly request this. For instance, this is true if a rule was matched that had tracking enabled for that specific rule.

Trait Implementations§

source§

impl Clone for Flag

source§

fn clone(&self) -> Flag

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Flag

source§

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

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

impl<'de> Deserialize<'de> for Flag

source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Flag, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Flag

source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Versioned for Flag

source§

fn version(&self) -> u64

Retrieve the version for this item instance.
source§

fn is_greater_than_or_equal(&self, version: u64) -> bool

Determine if this item’s version is greater than or equal to the provided version parameter.

Auto Trait Implementations§

§

impl Freeze for Flag

§

impl RefUnwindSafe for Flag

§

impl Send for Flag

§

impl Sync for Flag

§

impl Unpin for Flag

§

impl UnwindSafe for Flag

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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

§

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

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,