Crates.io | memo-map |
lib.rs | memo-map |
version | 0.3.3 |
source | src |
created_at | 2022-03-20 00:55:30.992253 |
updated_at | 2024-07-28 14:49:39.542091 |
description | A crate implementing a synchronized map for memoization |
homepage | |
repository | https://github.com/mitsuhiko/memo-map |
max_upload_size | |
id | 553393 |
size | 33,605 |
A concurrent insert only hash map.
This crate implements a “memo map” which is in many ways similar to a HashMap with some crucial differences:
use memo_map::MemoMap;
let memo = MemoMap::new();
let one = memo.get_or_insert(&1, || "one".to_string());
let one2 = memo.get_or_insert(&1, || "not one".to_string());
assert_eq!(one, "one");
assert_eq!(one2, "one");