changeset 5:5b4d00ea008d

Extend README.
author Lewin Bormann <lbo@spheniscida.de>
date Thu, 15 Oct 2020 13:29:59 +0200
parents 702afb217145
children d3528f4663a3
files README.md
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Thu Oct 15 13:28:47 2020 +0200
+++ b/README.md	Thu Oct 15 13:29:59 2020 +0200
@@ -3,6 +3,20 @@
 A `#[memoize]` attribute for somewhat simple Rust functions. 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.
+look at the `examples/`, if you want to know more:
+
+```rust
+use memoize::memoize;
+#[memoize]
+fn hello(arg: String) -> bool {
+     arg.len()%2 == 0
+}
+
+// `hello` is only called once here.
+assert!(! hello("World".to_string()));
+assert!(! hello("World".to_string()));
+// Sometimes one might need the original function.
+assert!(! memoized_original_hello("World".to_string()));
+```
 
 Intentionally not yet on crates.rs.