cached 4.0.0

Generic cache implementations and simplified function memoization
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
// Compile-pass: `force_refresh = true` (bare bool) on `#[once]` is accepted.
// The bare bool form is equivalent to `force_refresh = "{ true }"` and causes
// the single cached value to be unconditionally recomputed on every call.
use cached::macros::once;

#[once(force_refresh = true)]
fn f(x: i32) -> i32 {
    x
}

fn main() {
    let _ = f(1);
}