Macro holmes::holmes_exec [] [src]

macro_rules! holmes_exec {
    ($holmes:ident, { $( $action:expr );* }) => { ... };
}

Shorthand notation for performing many actions with the same holmes context Analogous to a weaker version of the Reader monad which cannot return values.

The first parameter is the holmes object to be used, and the second is a list of the actions to be performed, e.g.

holmes_exec!(holmes, {
  predicate!(foo(string, uint64));
  fact!(foo("bar", 3));
});

If any of the actions would error, the enclosing function will error out. This is due to a limitation in how the try! macro works. (It uses return to error out, rather than a bind-like mechanism).

This only works because the other macros have both an explicit ident form, and one which generates a function taking a holmes parameter instead.