Mercurial > lbo > hg > memoize
view examples/empty.rs @ 106:bb57757a7727 default tip
Added tag v0.4.1 for changeset 793f2e38a318
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 27 Oct 2023 20:22:19 +0200 |
parents | fbf408e00f17 |
children |
line wrap: on
line source
//! Reproduces (verifies) issue #17: Panics when used on fn without args. use memoize::memoize; #[memoize] fn hello() -> bool { println!("hello!"); true } fn main() { // `hello` is only called once here. assert!(hello()); assert!(hello()); memoized_flush_hello(); // and again here. assert!(hello()); }