fn filter_expression(input: &str) -> IResult<&str, FilterExpression<'_>> {
    let (rest, identifier) = spaced(identifier)(input)?;
    let (rest, op) =
        verify(spaced(operator), |op| identifier.can_be_used_with_operator(&op))(rest)?;
    let (rest, op) = map_opt(
        verify(
            spaced(alt((
                map(number, move |n| OneOrMany::One(Value::Number(n))),
                map(severity_sym, move |s| OneOrMany::One(Value::Severity(s))),
                map(string_literal, move |s| OneOrMany::One(Value::StringLiteral(s))),
                map(list_of_values, OneOrMany::Many),
            ))),
            |value| identifier.can_be_used_with_value_type(value),
        ),
        move |one_or_many| Operation::maybe_new(op, one_or_many),
    )(rest)?;
    Ok((rest, FilterExpression { identifier, op }))
}
/// Parses a single filter expression in a metadata selector.
Parses a single filter expression in a metadata selector.
Parses a single filter expression in a metadata selector .
fn filter_expression(input: &str) -> IResult<&str, FilterExpression<'_>> {
    let (rest, identifier) = spaced(identifier)(input)?;
    let (rest, op) =
        verify(spaced(operator), |op| identifier.can_be_used_with_operator(&op))(rest)?;
    let (rest, op) = map_opt(
        verify(
            spaced(alt((
                map(number, move |n| OneOrMany::One(Value::Number(n))),
                map(severity_sym, move |s| OneOrMany::One(Value::Severity(s))),
                map(string_literal, move |s| OneOrMany::One(Value::StringLiteral(s))),
                map(list_of_values, OneOrMany::Many),
            ))),
            |value| identifier.can_be_used_with_value_type(value),
        ),
        move |one_or_many| Operation::maybe_new(op, one_or_many),
    )(rest)?;
    Ok((rest, FilterExpression { identifier, op }))
}
fn filter_expression ( input : & str ) -> IResult < & str , FilterExpression < ' _ > > { let ( rest , identifier ) = spaced ( identifier ) ( input ) ? ; let ( rest , op ) = verify ( spaced ( operator ) , | op | identifier . can_be_used_with_operator ( & op ) ) ( rest ) ? ; let ( rest , op ) = map_opt ( verify ( spaced ( alt ( ( map ( number , move | n | OneOrMany :: One ( Value :: Number ( n ) ) ) , map ( severity_sym , move | s | OneOrMany :: One ( Value :: Severity ( s ) ) ) , map ( string_literal , move | s | OneOrMany :: One ( Value :: StringLiteral ( s ) ) ) , map ( list_of_values , OneOrMany :: Many ) , ) ) ) , | value | identifier . can_be_used_with_value_type ( value ) , ) , move | one_or_many | Operation :: maybe_new ( op , one_or_many ) , ) ( rest ) ? ; Ok ( ( rest , FilterExpression { identifier , op } ) ) }
Parses a single filter expression in a metadata selector.
Parses a single filter expression in a metadata selector .
input
&str
input
&str