timed-map
Lightweight map implementation that supports expiring entries and fully
compatible with both std and no_std environments.
TimedMap allows storing key-value pairs with optional expiration times. Expiration is
handled by an implementation of the Clock trait, which abstracts time handling for
no_std environments.
When std feature is enabled (which is the default case), Clock trait is handled
automatically from the crate internals with std::time::SystemTime.
Examples:
In std environments:
use ;
use Duration;
let mut map: = new;
map.insert_expirable;
assert_eq!;
assert!;
map.insert_constant;
assert_eq!;
assert!;
In no_std environments:
use Duration;
use ;
;
let clock = CustomClock;
let mut map = new;
map.insert_expirable;
assert_eq!;
assert!;
map.insert_constant;
assert_eq!;
assert!;