Crates.io | lockmap |
lib.rs | lockmap |
version | 0.1.1 |
source | src |
created_at | 2024-11-21 06:11:42.073079 |
updated_at | 2024-11-22 06:45:49.106641 |
description | A high-performance, thread-safe HashMap implementation for Rust that provides fine-grained locking at the key level. |
homepage | https://github.com/SF-Zhou/lockmap |
repository | https://github.com/SF-Zhou/lockmap |
max_upload_size | |
id | 1455758 |
size | 39,780 |
A high-performance, thread-safe HashMap implementation for Rust that provides fine-grained locking at the key level.
use lockmap::LockMap;
// Create a new lock map
let map = LockMap::new();
// Set a value
map.set("key", "value");
// Get a value
assert_eq!(map.get("key"), Some("value"));
// Use entry API for exclusive access
{
let entry = map.entry("key");
*entry.value = Some("new value");
}
// Remove a value
map.remove("key");