pub struct SessionLock { /* private fields */ }Expand description
Held for the runtime’s lifetime; dropping releases the flock.
Implementations§
Source§impl SessionLock
impl SessionLock
Sourcepub fn release_and_remove(self)
pub fn release_and_remove(self)
Release the lock AND remove the lock file. For a session that never
journaled (ended Idle, F18) the .lock next to no .json is pure
litter; a session WITH a journal keeps its file (harmless, reaped on
the next acquire). Best effort: a failed unlink is not an error.
Sourcepub fn try_acquire(
dir: &Path,
id: &str,
holder: LockHolder,
) -> Result<Self, SessionLockError>
pub fn try_acquire( dir: &Path, id: &str, holder: LockHolder, ) -> Result<Self, SessionLockError>
Try to acquire an exclusive flock on <dir>/<id>.lock.
Returns Ok(lock) on success; Err with an actionable message if
another process holds it (or on I/O error).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionLock
impl RefUnwindSafe for SessionLock
impl Send for SessionLock
impl Sync for SessionLock
impl Unpin for SessionLock
impl UnsafeUnpin for SessionLock
impl UnwindSafe for SessionLock
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