function-wrapper
Rust attribute macro library that makes it easy to wrap functions in code that runs before and / or after a function executes.
This function
which is being wrapped by this attribute
use WrappedFn;
extern crate proc_macro;
extern crate proc_macro2;
use parse_macro_input;
use quote;
// Adds print statements before and after a function executes.
will turn into this after being compiled.
If only pre-code is added, a wrapper closure and extra return expression won't be added since they are unecessary in this case. If only post-code is added, the wrapper closure and return expression will still need to be added.