Mercurial > lbo > hg > lazycall
changeset 3:86c31f04fd15
lazycall is very useless.
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 20 Nov 2020 23:31:09 +0100 |
parents | 2b71ed370156 |
children | 55bf86f40457 |
files | README.md |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Fri Nov 20 23:31:09 2020 +0100 @@ -0,0 +1,21 @@ +# `lazycall` + +is very useless. It allows for automatically moving the computation of arguments +into a called function. + +```rust +#[lazy] +fn myfunc(a: i32) -> i32 { + a + 1 +} + +fn main() { + println!("{}", lazycall!(myfunc(31))); + + // essentially: + println!("{}", myfunc_lazy(|| myfunc(31))); + // wherein myfunc_lazy() evaluates the specified closure. +} +``` + +It is mostly to be viewed as a finger exercise in procedural macros.