skip-if
This Rust attribute macro skips running a function that produces a file or a folder (output
) depending on a strategy
.
The strategy (specified in the strategy
attribute) has access to:
- The arguments hash (excluding the ones provided in the
args_skip
attributes); - The source code hash;
- The output path (as provided in the
output
attribute). - A callback with a reference to the result of the method call.
For convenience, the function on which the skip_if
attribute is applied can access the value of the output
expression through the skip_if_output
variable.
Sample strategies
The simplest strategy, skip_if::FileExists
, is to skip when the output
path exists.
A more advanced strategy, skip_if::Markers
, offers the following options:
- Use a marker success file (
{output}.success
) with source and arguments hashes to never skip when these change, even if the output file already exists. - Use a marker failure file (
{output}.failure
) to skip after a failure.- Optionally, take into account source and argument hashes to retry nevertheless when these change.
- Optionally, mark some errors as retriable.
- Directory mode, where output is assumed to be a directory. The
success
andfailure
markers are stored inside.
TODO
- Allow selectively disabling code and argument hashing (they are now tied together).