Skip to main content

Condition

Enum Condition 

Source
#[non_exhaustive]
pub enum Condition { Equal { key: String, value: Value, }, NotEqual { key: String, value: Value, }, Less { key: String, value: Value, }, LessEqual { key: String, value: Value, }, Greater { key: String, value: Value, }, GreaterEqual { key: String, value: Value, }, In { key: String, values: Vec<Value>, }, NotIn { key: String, values: Vec<Value>, }, Exists { key: String, }, NotExists { key: String, }, }
Expand description

A single comparison operator applied to one metadata key.

Equality, range, and membership conditions require a concrete stored value. An absent key or Value::Unset produces an unknown outcome that remains unknown under logical negation and therefore fails closed when matching. Existence conditions define presence in terms of a concrete value.

§Examples

use qubit_metadata::Condition;

let condition = Condition::Equal {
    key: "tenant".to_owned(),
    value: "acme".into(),
};
assert!(matches!(condition, Condition::Equal { .. }));

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Equal

Key equals value.

Fields

§key: String

The metadata key.

§value: Value

The expected value.

§

NotEqual

Key does not equal value.

Fields

§key: String

The metadata key.

§value: Value

The value to compare against.

§

Less

Key is less than value.

Fields

§key: String

The metadata key.

§value: Value

The upper bound (exclusive).

§

LessEqual

Key is less than or equal to value.

Fields

§key: String

The metadata key.

§value: Value

The upper bound (inclusive).

§

Greater

Key is greater than value.

Fields

§key: String

The metadata key.

§value: Value

The lower bound (exclusive).

§

GreaterEqual

Key is greater than or equal to value.

Fields

§key: String

The metadata key.

§value: Value

The lower bound (inclusive).

§

In

The stored value is one of the listed candidates.

Fields

§key: String

The metadata key.

§values: Vec<Value>

The set of acceptable values.

§

NotIn

The stored value is not any of the listed candidates.

Fields

§key: String

The metadata key.

§values: Vec<Value>

The set of excluded values.

§

Exists

The key stores a concrete value.

An absent key or a key storing Value::Unset does not exist for filter matching.

Fields

§key: String

The metadata key.

§

NotExists

The key does not store a concrete value.

An absent key or a key storing Value::Unset satisfies this condition.

Fields

§key: String

The metadata key.

Trait Implementations§

Source§

impl Clone for Condition

Source§

fn clone(&self) -> Condition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Condition

Source§

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

Writes the strict-policy diagnostic representation.

Source§

impl PartialEq for Condition

Source§

fn eq(&self, other: &Condition) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Redact for Condition

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Writes a diagnostic condition representation under the active policy.

The condition node is entered before its discriminant is inspected. The synthetic operator label is derived from that discriminant and does not consume a field node. The source key and optional operand fields are admitted in source order. Accessors are invoked only after admission; operand access is skipped for opaque masking but remains available to a disabled policy that intentionally restores source values. A node-budget rejection adds one structural truncation field and terminates the branch without touching the rejected field.

§Parameters
  • writer - Structured destination carrying the active policy and cumulative domain budgets.
Source§

impl StructuralPartialEq for Condition

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value. Read more
Source§

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

Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.