memoize
A #[memoize]
attribute for somewhat simple Rust functions: That is, functions
with one or more Clone
-able arguments, and a Clone
-able return type. That's it.
Read the documentation (cargo doc --open
) for the sparse details, or take a
look at the examples/
, if you want to know more:
use memoize;
// `hello` is only called once here.
assert!;
assert!;
// Sometimes one might need the original function.
assert!;
This is, aside from the assert
s, expanded into:
// This is obviously further expanded before compiling.
lazy_static!
Contributions
...are always welcome! This being my first procedural-macros crate, I am grateful for improvements of functionality and style. Please send a pull request, and don't be discouraged if it takes a while for me to review it -- I'm sometimes a bit slow to catch up here :) -- Lewin