inline_tweak

Tweak any literal directly from your code, changes to the source appear while running the program.
It works by parsing the file when a change occurs.
The library is minimal with 0 dependencies.
In release mode, the tweaking code is disabled and compiled away.
The derive feature exposes a proc macro to turn all literals from a function body into tweakable values.
inline_tweak is based on this blogpost by tuxedo labs.
Usage
use *;
Extra features
derive
The derive feature allows to tweak any number/bool/char literal in a function.
It avoids cluttering the code with inline_tweak::tweak! calls.
Note that it requires syn/quote/proc_macro2 dependencies which makes the crate slower to compile.
Contrary to tweak!, it does not allow tweaking literals in macro calls (like println!), as it cannot reliably replace literals by a function call since macros can have custom syntax.
watch!
inline_tweak provides a watch!() macro that sleeps until the file is modified, akin to a breakpoint:
use *;
Expressions
inline_tweak allows to tweak expressions by providing a value later.
For example:
tweak!
can then be replaced by a constant value by modifying the file (even while the application is running) to
tweak! // will always return 5.0
See the "expression" example in action
Note that this works only for expressions that return a tweakable type. (number/boolean literals)
release_tweak!
The release_tweak! macro acts exactly like tweak! except that it also works in release mode.
It is accessible behind the feature flag "release_tweak" which is not enabled by default.
Installation
Simply add this line to your Cargo.toml
= "1.0.10"