2 releases
0.1.2 | Jun 15, 2024 |
---|---|
0.1.1 | Apr 1, 2024 |
#585 in Asynchronous
13KB
299 lines
NapMap
NapMap
is an async HashMap
that halts requester tasks until the requested data is accessible.
Fundementally it's a syncronization tool between tasks, were tasks can write on to the map and other can read from it.
Example Usage
#[tokio::main]
async fn main() {
let napmap = Arc::new(UnboundedNapMap::new());
tokio::spawn({
let map = napmap.clone();
async move {
tokio::time::sleep(Duration::from_secs(2)).await;
map.insert("key", 7).await;
}
});
let value = napmap.get("key").await.unwrap();
println!("value: {value}");
}
Dependencies
~3–8.5MB
~67K SLoC