| Crates.io | closure_cacher |
| lib.rs | closure_cacher |
| version | 0.2.1 |
| created_at | 2021-05-06 19:18:31.291927+00 |
| updated_at | 2021-05-10 16:03:29.307107+00 |
| description | Allows caching of user specified closure. |
| homepage | |
| repository | https://github.com/khalilw1/closure_cacher |
| max_upload_size | |
| id | 393928 |
| size | 4,640 |
This library offer caching for a user provided closure. There are two types of cachers inside:
use closure_cacher::Cacher;
let mut cacher = Cacher::new(|x| x + 1)
println("{}", cacher.get(&4)); // outputs 5
use closure_cacher::RefCacher;
let four = 4;
let mut cacher = RefCacher::new(|x| x + 1)
println("{}", cacher.get(&four));
If you have any feature request or enhancement in mind. I would love to add it :)
This is not a very critical library i.e. it does one job in a very standard way.
You could usually just write it again.
I used it as part of my pass through the rust book and decided to go ahead and share so any feedback is appreciated.