Mercurial > lbo > hg > memoize
changeset 13:0b9fe6ecae86
Update README
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Thu, 15 Oct 2020 14:22:11 +0200 |
parents | 38b5f1dcfbef |
children | 4603aaa0378c |
files | README.md |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Thu Oct 15 14:21:12 2020 +0200 +++ b/README.md Thu Oct 15 14:22:11 2020 +0200 @@ -9,15 +9,15 @@ ```rust use memoize::memoize; #[memoize] -fn hello(arg: String) -> bool { - arg.len()%2 == 0 +fn hello(arg: String, arg2: usize) -> bool { + arg.len()%2 == arg2 } // `hello` is only called once here. -assert!(! hello("World".to_string())); -assert!(! hello("World".to_string())); +assert!(! hello("World".to_string(), 0)); +assert!(! hello("World".to_string(), 0)); // Sometimes one might need the original function. -assert!(! memoized_original_hello("World".to_string())); +assert!(! memoized_original_hello("World".to_string(), 0)); ``` This is, aside from the `assert`s, expanded into: