pub struct FilterIR {
pub clauses: Vec<Disjunction>,
}Expand description
Canonical Filter IR in Conjunctive Normal Form (CNF)
CNF = (A₁ ∨ A₂) ∧ (B₁) ∧ (C₁ ∨ C₂ ∨ C₃)
This representation enables:
- Systematic index path selection (each clause maps to an index)
- Easy conjunction with auth scope (just append clauses)
- Efficient serialization and transmission
Fields§
§clauses: Vec<Disjunction>Conjunction of disjunctions (CNF form)
Implementations§
Source§impl FilterIR
impl FilterIR
Sourcepub fn from_atom(atom: FilterAtom) -> Self
pub fn from_atom(atom: FilterAtom) -> Self
Create a filter from a single atom
Sourcepub fn from_disjunction(disj: Disjunction) -> Self
pub fn from_disjunction(disj: Disjunction) -> Self
Create a filter from a single disjunction
Sourcepub fn and(self, other: FilterIR) -> Self
pub fn and(self, other: FilterIR) -> Self
Conjoin (AND) with another filter
This is the key operation for auth scope injection:
EffectiveFilter = AuthScope ∧ UserFilter
Sourcepub fn and_atom(self, atom: FilterAtom) -> Self
pub fn and_atom(self, atom: FilterAtom) -> Self
Conjoin with a single atom
Sourcepub fn or(self, other: FilterIR) -> Self
pub fn or(self, other: FilterIR) -> Self
Disjoin (OR) with another filter
Note: This may expand the CNF representation
Sourcepub fn atoms_for_field(&self, field: &str) -> Vec<&FilterAtom>
pub fn atoms_for_field(&self, field: &str) -> Vec<&FilterAtom>
Extract atoms for a specific field
Sourcepub fn constrains_field(&self, field: &str) -> bool
pub fn constrains_field(&self, field: &str) -> bool
Check if this filter constrains a specific field
Sourcepub fn constrained_fields(&self) -> HashSet<&str>
pub fn constrained_fields(&self) -> HashSet<&str>
Get all fields constrained by this filter
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FilterIR
impl<'de> Deserialize<'de> for FilterIR
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for FilterIR
Auto Trait Implementations§
impl Freeze for FilterIR
impl RefUnwindSafe for FilterIR
impl Send for FilterIR
impl Sync for FilterIR
impl Unpin for FilterIR
impl UnsafeUnpin for FilterIR
impl UnwindSafe for FilterIR
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more