pub trait Flock<'a>: Debug {
type ExclusiveLock: FlockLock + 'a;
type ExclusiveSliceLock: FlockLock + 'a;
type SharedLock: FlockLock + 'a;
type SharedSliceLock: FlockLock + 'a;
fn try_exclusive_lock(
&'a self
) -> Result<Option<Self::ExclusiveSliceLock>, Error>;
fn exclusive_lock(&'a self) -> Result<Self::ExclusiveSliceLock, Error>;
fn file_exclusive_lock(self) -> Result<Self::ExclusiveLock, Error>;
fn try_file_exclusive_lock(
self
) -> Result<Option<Self::ExclusiveLock>, Error>;
fn try_shared_lock(&'a self) -> Result<Option<Self::SharedSliceLock>, Error>;
fn shared_lock(&'a self) -> Result<Self::SharedSliceLock, Error>;
fn file_shared_lock(self) -> Result<Self::SharedLock, Error>;
fn try_file_shared_lock(self) -> Result<Option<Self::SharedLock>, Error>;
}
Required Associated Types§
type ExclusiveLock: FlockLock + 'a
type ExclusiveSliceLock: FlockLock + 'a
Required Methods§
fn try_exclusive_lock(
&'a self
) -> Result<Option<Self::ExclusiveSliceLock>, Error>
sourcefn exclusive_lock(&'a self) -> Result<Self::ExclusiveSliceLock, Error>
fn exclusive_lock(&'a self) -> Result<Self::ExclusiveSliceLock, Error>
Set exclusive lock. Lock current thread in case of file lock. Only one process can retain exclusive lock of the file.
sourcefn file_exclusive_lock(self) -> Result<Self::ExclusiveLock, Error>
fn file_exclusive_lock(self) -> Result<Self::ExclusiveLock, Error>
Set exclusive lock. Lock current thread in case of file lock. Only one process can retain exclusive lock of the file.
fn try_file_exclusive_lock(self) -> Result<Option<Self::ExclusiveLock>, Error>
Set shared lock. Lock current thread in case of file lock. Can retain the general lock on the given file more than one process.
Set shared lock. Lock current thread in case of file lock. Can retain the general lock on the given file more than one process.