Skip to main content

Module mutex_map

Module mutex_map 

Source
Expand description

Per-key asynchronous mutual exclusion with automatic entry cleanup.

Each key maps to a Tokio mutex shared by its current contenders. The last contender to release its claim removes the entry, whether it held the mutex or was canceled while waiting for it.

Re-exportsยง

use std::fmt::Debug; ๐Ÿ”’
use std::fmt::Debug; ๐Ÿ”’
use std::hash::Hash; ๐Ÿ”’
use std::hash::Hash; ๐Ÿ”’
use std::sync::Arc; ๐Ÿ”’
use std::sync::TryLockError::WouldBlock; ๐Ÿ”’
use futures::StreamExt; ๐Ÿ”’
use itertools::Itertools; ๐Ÿ”’
use tokio::sync::OwnedMutexGuard as Omg; ๐Ÿ”’
use crate::Result; ๐Ÿ”’
use crate::err; ๐Ÿ”’
use crate::utils::IterStream; ๐Ÿ”’

Structsยง

Guard
Keeps a keyed mutex locked until the guard is dropped.
MutexMap
Provides independent asynchronous mutexes keyed by owned values.

Type Aliasesยง

HashMap ๐Ÿ”’
Map ๐Ÿ”’
MapMutex ๐Ÿ”’
Value ๐Ÿ”’