7 releases
new 0.1.6 | Jan 20, 2025 |
---|---|
0.1.5 | Jan 18, 2025 |
0.1.4 | Dec 31, 2024 |
0.1.1 | Nov 22, 2024 |
#688 in Concurrency
527 downloads per month
45KB
922 lines
lockmap
A high-performance, thread-safe HashMap implementation for Rust that provides fine-grained locking at the key level.
Usage
use lockmap::LockMap;
// Create a new lock map
let map = LockMap::<String, String>::new();
// Set a value
map.insert_by_ref("key", "value".into());
// Get a value
assert_eq!(map.get("key"), Some("value".into()));
// Use entry API for exclusive access
{
let mut entry = map.entry_by_ref("key");
*entry.get_mut() = Some("new value".into());
}
// Remove a value
assert_eq!(map.remove("key"), Some("new value".into()));
Dependencies
~0–10MB
~43K SLoC