pub struct FileLock {
pub recovered_stale: Option<LockOwner>,
/* private fields */
}Expand description
Held until dropped (or the process dies).
Fields§
§recovered_stale: Option<LockOwner>Owner of a lock left behind by a process that is gone, when one was found.
Implementations§
Source§impl FileLock
impl FileLock
Sourcepub fn acquire(path: &Path, options: &LockOptions) -> Result<Self>
pub fn acquire(path: &Path, options: &LockOptions) -> Result<Self>
Exclusive lock; waits up to options.timeout.
Sourcepub fn try_acquire(path: &Path) -> Result<Self>
pub fn try_acquire(path: &Path) -> Result<Self>
Fail immediately when busy.
Shared (reader) lock: many readers, excluded by a writer. No owner record.
pub fn path(&self) -> &Path
Sourcepub fn current_owner(lock_path: &Path) -> Option<LockOwner>
pub fn current_owner(lock_path: &Path) -> Option<LockOwner>
The holder recorded on disk for lock_path (diagnostics; may be stale).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileLock
impl RefUnwindSafe for FileLock
impl Send for FileLock
impl Sync for FileLock
impl Unpin for FileLock
impl UnsafeUnpin for FileLock
impl UnwindSafe for FileLock
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