pub enum Reason {
    Off,
    TargetMatch,
    RuleMatch {
        rule_index: usize,
        rule_id: String,
        in_experiment: bool,
    },
    PrerequisiteFailed {
        prerequisite_key: String,
    },
    Fallthrough {
        in_experiment: bool,
    },
    Error {
        error: Error,
    },
}
Expand description

Reason describes the reason that a flag evaluation produced a particular value.

Variants

Off

Off indicates that the flag was off and therefore returned its configured off value.

TargetMatch

TargetMatch indicates that the user key was specifically targeted for this flag.

RuleMatch

Fields

rule_index: usize

Zero-based index of the crate::FlagRule that was matched.

rule_id: String

The id property of the crate::FlagRule::id that was matched.

in_experiment: bool

This optional boolean property is true if the variation was determined by a crate::Rollout whose kind was crate::RolloutKind::Experiment and if the selected crate::WeightedVariation did not have an untracked property of true. It is false otherwise.

RuleMatch indicates that the user matched one of the flag’s rules.

PrerequisiteFailed

Fields

prerequisite_key: String

The key of the prerequisite flag that failed.

PrerequisiteFailed indicates that the flag was considered off because it had at least one prerequisite flag that either was off or did not return the desired variation.

Fallthrough

Fields

in_experiment: bool

This optional boolean property is true if the variation was determined by a crate::Rollout whose kind was crate::RolloutKind::Experiment and if the selected crate::WeightedVariation did not have an untracked property of true. It is false otherwise.

Fallthrough indicates that the flag was on but the user did not match any targets or rules.

Error

Fields

error: Error

An error representing the Reason::Error.

Error indicates that the flag could not be evaluated, e.g. because it does not exist or due to an unexpected error. In this case the result value will be the default value that the caller passed to the client.

Implementations

This method determines whether or not the provided Reason is considered to be part of an ongoing experiment.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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