pub struct FilterExpression { /* private fields */ }Expand description
An immutable Boolean expression in a crate::MetadataFilter.
Expressions are constructed by FilterExpressionBuilder and can be
inspected without allocation through FilterExpression::view. Their
private representation prevents callers from constructing structurally
invalid expression trees. The structure is Boolean, while evaluation uses
a private three-valued outcome so missing data stays unknown through NOT,
AND, and OR.
§Examples
use qubit_metadata::FilterExpression;
let expression = FilterExpression::builder()
.eq("tenant", "acme")
.build()?;
assert!(matches!(
expression.view(),
qubit_metadata::FilterExpressionView::Condition(_)
));Implementations§
Source§impl FilterExpression
impl FilterExpression
Sourcepub const fn builder() -> FilterExpressionBuilder
pub const fn builder() -> FilterExpressionBuilder
Creates a builder for a non-empty filter expression.
Sourcepub const fn match_none() -> Self
pub const fn match_none() -> Self
Creates an expression that matches no metadata object.
Sourcepub fn try_and(self, other: Self) -> MetadataResult<Self>
pub fn try_and(self, other: Self) -> MetadataResult<Self>
Combines this expression with other using logical AND.
§Errors
Returns MetadataError::FilterLimitExceeded when the resulting
expression exceeds library hard limits.
Sourcepub fn try_or(self, other: Self) -> MetadataResult<Self>
pub fn try_or(self, other: Self) -> MetadataResult<Self>
Combines this expression with other using logical OR.
§Errors
Returns MetadataError::FilterLimitExceeded when the resulting
expression exceeds library hard limits.
Sourcepub fn try_not(self) -> MetadataResult<Self>
pub fn try_not(self) -> MetadataResult<Self>
Negates this expression.
§Errors
Returns MetadataError::FilterLimitExceeded when the resulting
expression exceeds library hard limits.
Sourcepub fn view(&self) -> FilterExpressionView<'_>
pub fn view(&self) -> FilterExpressionView<'_>
Returns a borrowed view of this expression node.
§Returns
A zero-copy view preserving the node’s Boolean structure.
Trait Implementations§
Source§impl Clone for FilterExpression
impl Clone for FilterExpression
Source§fn clone(&self) -> FilterExpression
fn clone(&self) -> FilterExpression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more