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. Comparisons of concrete values can also be unknown when their types or operations are incompatible or a numeric comparison fails; compatible numeric types follow the configured NumericComparisonPolicy, and values are not implicitly converted. Unknown remains unknown under logical negation, so ne, negated comparisons, and not_in_set cannot bypass an incomparable type. Existence conditions define presence in terms of a concrete value and return definite Boolean outcomes. Membership conditions compare candidates individually and prefer a definite result over an unknown candidate.

§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) -> Self

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.

§Parameters
  • formatter - Formatter that receives the output.
Source§

impl PartialEq for Condition

Source§

fn eq(&self, other: &Self) -> 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 discriminant is inspected and an optional operand is borrowed before the record node is entered. The record and synthetic operator field consume node budget, as do admitted key and operand fields. Field formatting is deferred until admission; opaque masking skips operand formatting. A node-budget rejection adds a structural truncation field and stops the branch before formatting that 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

Returns the owned value unchanged as the default.

§Returns

The input value, moved without cloning.

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.