pub struct LockedFile(/* private fields */);Expand description
A file lock that is automatically released when dropped.
Implementations§
Source§impl LockedFile
impl LockedFile
Sourcepub fn acquire_blocking(
path: impl AsRef<Path>,
resource: impl Display,
) -> Result<Self, Error>
pub fn acquire_blocking( path: impl AsRef<Path>, resource: impl Display, ) -> Result<Self, Error>
The same as [LockedFile::acquire], but for synchronous contexts.
Do not use from an async context, as this can block the runtime while waiting for another process to release the lock.
The same as LockedFile::acquire_blocking, but for synchronous contexts.
Do not use from an async context, as this can block the runtime while waiting for another process to release the lock.
Sourcepub fn acquire_no_wait(
path: impl AsRef<Path>,
resource: impl Display,
) -> Option<Self>
pub fn acquire_no_wait( path: impl AsRef<Path>, resource: impl Display, ) -> Option<Self>
Acquire a cross-process lock for a resource using a file at the provided path
Unlike [LockedFile::acquire] this function will not wait for the lock to become available.
If the lock is not immediately available, None is returned.
Trait Implementations§
Source§impl Debug for LockedFile
impl Debug for LockedFile
Auto Trait Implementations§
impl Freeze for LockedFile
impl RefUnwindSafe for LockedFile
impl Send for LockedFile
impl Sync for LockedFile
impl Unpin for LockedFile
impl UnwindSafe for LockedFile
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more