4 releases (2 breaking)

0.3.0 May 18, 2023
0.2.1 May 13, 2023
0.2.0 May 13, 2023
0.1.0 May 13, 2023

#1825 in Development tools

Download history 12/week @ 2024-03-08 4/week @ 2024-03-15 12/week @ 2024-03-29 8/week @ 2024-04-05 85/week @ 2024-04-12 14/week @ 2024-05-24 86/week @ 2024-05-31

95 downloads per month

MIT license

9KB
101 lines

todo_by

Compile-time lifetimes for comments.


To use this macro, add it to your dependencies via Cargo:

cargo add todo_by

Then, import and invoke the macro and add a date (such as above a function or statement) like so:

use todo_by::todo_by;

todo_by!("2023-06-01");
fn my_function() {
    // TODO: Implement this function by June 1st, 2023
}

If the current date is after June 1st, 2023, the macro will generate a compile error with the message “TODO by Jun 1, 2023 has passed”. If the current date is on or before June 1st, 2023, the macro will expand to nothing and the code will compile normally.

You can also add specific TODO comments:

todo_by!("2023-06-01", "Clean up implementation");

The todo_while macro allows you to ensure todos are done based on a semver requirement of what is in your Cargo.toml:

use todo_by::todo_while;

todo_while!("<1.0.0", "This has to be in the first major release")

This also allows you to make blockers:

todo_while!(">123.4", "Must fix this or bump the version")

Important note for library authors

Currently, if you publish/offer a crate and a todo_by expires in the lib code, then it would be an unfixable compilation error for anyone importing the crate. This problem is being investigated - please offer solutions if you have any!

You might find useful

Here're some alternative implementations for other languages and tools:

Dependencies

~1.7–2.6MB
~48K SLoC