pub enum Condition {
Has(String),
Equals {
field: String,
value: String,
},
Not(Box<Condition>),
AllOf(Vec<Condition>),
AnyOf(Vec<Condition>),
}Expand description
A condition a document’s metadata must satisfy.
Variants§
Has(String)
The field is present and carries at least one non-empty value.
“Present” means usable, not merely written: a people: with an empty
string under it has nothing to group or display, and a view that
included it would be showing a row it cannot say anything about.
Equals
The field carries this value — any element of it, for a sequence, so
equals: { people: Ada } matches a document listing several people.
Not(Box<Condition>)
The inverse of the condition it wraps.
AllOf(Vec<Condition>)
Every condition must hold. An empty list holds vacuously, which is what makes it the identity a multi-key mapping folds into.
AnyOf(Vec<Condition>)
At least one condition must hold. An empty list holds for nothing, so a
any-of: [] selects nothing rather than everything — the reading that
cannot silently publish a whole workspace.
Implementations§
Source§impl Condition
impl Condition
Sourcepub fn parse(value: &Value) -> Option<Self>
pub fn parse(value: &Value) -> Option<Self>
Read a where: block.
Returns None for a value that is not a mapping, or one that yields no
condition at all — an empty where: is not a filter that excludes
everything, it is a view that did not say anything, and treating it as
the former would hide a whole workspace behind a typo.
Trait Implementations§
impl Eq for Condition
impl StructuralPartialEq for Condition
Auto Trait Implementations§
impl Freeze for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnsafeUnpin for Condition
impl UnwindSafe for Condition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.