Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
feat: clearer aliases for event filter boolean operators
Merged liw opened 1 year ago

The boolean operators “And”, “Or”, and “Not”, all take a list of filter expressions as operands. In normal boolean logic they take two or one, and the list case can be a little confusing to read. Introduce aliases “AllOf”, “AnyOf”, and “NoneOf”. These are merely aliases for the operators, with the exact same semantics.

Signed-off-by: Lars Wirzenius liw@liw.fi

1 file changed +3 -0 623e590c 9b35d116
modified src/filter.rs
@@ -89,12 +89,15 @@ pub enum EventFilter {
    Deny,

    /// Allow the opposite of the contained filter.
+
    #[serde(alias = "NoneOf")]
    Not(Vec<EventFilter>),

    /// Allow if all contained filters allow.
+
    #[serde(alias = "AllOf")]
    And(Vec<EventFilter>),

    /// Allow if any contained filter allow.
+
    #[serde(alias = "AnyOf")]
    Or(Vec<EventFilter>),
}