#cache #fn #map

cached_fn

Cache a function's result in a map

1 unstable release

0.1.1 Oct 17, 2024
0.1.0 Oct 17, 2024

#141 in Caching

Download history 238/week @ 2024-10-15 9/week @ 2024-10-22 4/week @ 2024-10-29 16/week @ 2024-11-05

267 downloads per month

MIT/Apache

7KB
55 lines

Cached Fn

Cache a function's result in a map.

Example

let mut cached_sqr = cached(|x| x * x);
assert_eq!(cached_sqr(3), 9);

lib.rs:

Cache a function's result in a map.

Example

let mut cached_sqr = cached(|x| x * x);
assert_eq!(cached_sqr(3), 9);

Dependencies

~25KB