4 releases

0.3.3 Jul 28, 2024
0.3.2 Aug 27, 2023
0.3.1 Mar 20, 2022
0.2.1 Mar 20, 2022
0.1.0 Mar 20, 2022

#61 in Concurrency

Download history 7493/week @ 2024-07-04 10525/week @ 2024-07-11 11493/week @ 2024-07-18 10747/week @ 2024-07-25 11991/week @ 2024-08-01 14498/week @ 2024-08-08 12137/week @ 2024-08-15 13994/week @ 2024-08-22 12572/week @ 2024-08-29 14110/week @ 2024-09-05 13911/week @ 2024-09-12 13827/week @ 2024-09-19 13248/week @ 2024-09-26 12552/week @ 2024-10-03 13359/week @ 2024-10-10 18793/week @ 2024-10-17

60,677 downloads per month
Used in 74 crates (4 directly)

Apache-2.0

21KB
356 lines

memo-map

Build Status Crates.io License rustc 1.41.0 Documentation

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:

  • Unlike a regular hash map, a memo map is thread safe and synchronized.
  • Adding or retrieving keys works through a shared reference, removing only through a mutable reference.
  • Retrieving a value from a memo map returns a plain old reference.
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");

No runtime deps