pub struct SessionGate { /* private fields */ }Expand description
Registry of per-session mutexes.
Uses a RwLock<HashMap> to lazily create mutex entries. The outer
RwLock is held briefly (read or write) to look up / insert a
mutex handle; the actual session serialization happens via the
inner Mutex.
Implementations§
Source§impl SessionGate
impl SessionGate
Sourcepub async fn acquire(
&self,
session_id: Uuid,
) -> Result<SessionGuard, SessionBusy>
pub async fn acquire( &self, session_id: Uuid, ) -> Result<SessionGuard, SessionBusy>
Acquires a session lock, returning an RAII guard.
If the session is already held by another run, this returns immediately with an error rather than waiting — concurrent writes to the same session are a programming mistake, not a normal contention scenario.
§Errors
Returns SessionBusy if the lock is already held.
Trait Implementations§
Source§impl Clone for SessionGate
impl Clone for SessionGate
Source§fn clone(&self) -> SessionGate
fn clone(&self) -> SessionGate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionGate
impl Debug for SessionGate
Source§impl Default for SessionGate
impl Default for SessionGate
Source§fn default() -> SessionGate
fn default() -> SessionGate
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for SessionGate
impl !UnwindSafe for SessionGate
impl Freeze for SessionGate
impl Send for SessionGate
impl Sync for SessionGate
impl Unpin for SessionGate
impl UnsafeUnpin for SessionGate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more