Trait issue_states::condition::ConditionFactory
source · pub trait ConditionFactory<C>where
C: Condition + Sized,{
type Error: From<Error> + EError;
fn make_condition(
&self,
name: &str,
neg: bool,
val_op: Option<(MatchOp, &str)>
) -> RResult<C, Self::Error>;
fn parse_condition(&self, string: &str) -> RResult<C, Self::Error> { ... }
}
Expand description
Factory trait for conditions
This trait allows issue states parsers to create conditions from a string
representation. Implementers need not implement the actual parsing. Instead,
the function make_condition()
will be supplied with the components of a
condition.
Required Associated Types§
Required Methods§
sourcefn make_condition(
&self,
name: &str,
neg: bool,
val_op: Option<(MatchOp, &str)>
) -> RResult<C, Self::Error>
fn make_condition(
&self,
name: &str,
neg: bool,
val_op: Option<(MatchOp, &str)>
) -> RResult<C, Self::Error>
Create a condition from bits and pieces
The condition will be assembled from the “metadata identifier” (e.g. the name of the piece of metadata), a flag indicating whether the condition is negated or not and, optionally, the matching operator and a string representation of the right-hand side value.
If the operator and value are not present, the resulting condition is expected to yield true if the piece of metadata denoted by the metadata identifier is present, e.g. non-null.
Provided Methods§
sourcefn parse_condition(&self, string: &str) -> RResult<C, Self::Error>
fn parse_condition(&self, string: &str) -> RResult<C, Self::Error>
Parse a condition directly from a string
This function parses a Condition
directly from a string using the
make_condition()
function.