Skip to content

A crate implementing a synchronized map for memoization

License

Notifications You must be signed in to change notification settings

shubhexists/memo-map

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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");

License and Links

About

A crate implementing a synchronized map for memoization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 97.2%
  • Makefile 2.8%