Skip to main content

cvlr_def_predicates

Macro cvlr_def_predicates 

Source
macro_rules! cvlr_def_predicates {
    ($(pred $name: ident ( $c:ident : $ctx: ident ) {  $( $e: expr );* $(;)? })*) => { ... };
}
Expand description

Defines multiple predicates in a single macro invocation.

This is a convenience macro that allows you to define multiple predicates at once using the same syntax as cvlr_def_predicate!.

§Syntax

cvlr_def_predicates! {
    pred <name1> ( <c1> : <ctx> ) { ... }
    pred <name2> ( <c2> : <ctx> ) { ... }
    ...
}

§Examples

use cvlr_spec::cvlr_def_predicates;

struct MyContext {
    x: i32,
}

cvlr_def_predicates! {
    pred IsPositive ( c : MyContext ) {
        c.x > 0;
    }
    pred IsEven ( c : MyContext ) {
        c.x % 2 == 0;
    }
}