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

#68 in Concurrency

Download history 13881/week @ 2024-09-14 14217/week @ 2024-09-21 12233/week @ 2024-09-28 13171/week @ 2024-10-05 13817/week @ 2024-10-12 19616/week @ 2024-10-19 15350/week @ 2024-10-26 16871/week @ 2024-11-02 17378/week @ 2024-11-09 17864/week @ 2024-11-16 15267/week @ 2024-11-23 18306/week @ 2024-11-30 20079/week @ 2024-12-07 26843/week @ 2024-12-14 7863/week @ 2024-12-21 7216/week @ 2024-12-28

64,886 downloads per month
Used in 88 crates (5 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