pub struct FileLock { /* private fields */ }
Expand description
Defines a wrapper around a file handle that can be used to implement file locks.
Implementations§
source§impl FileLock
impl FileLock
sourcepub fn lock(
name: impl AsRef<str>,
version: impl AsRef<Version>,
path: impl Into<PathBuf>,
) -> Result<Self, Error>
pub fn lock( name: impl AsRef<str>, version: impl AsRef<Version>, path: impl Into<PathBuf>, ) -> Result<Self, Error>
Constructor for the FileLock that attempts to lock the given file.
This function will block until it becomes available.
Note that this lock is an exclusive lock.
§Arguments
name
: The name of the package for which we are waiting.version
: The version of the package for which we are waiting.path
: The path of the file to use a lockfile.
§Returns
A new instance of the FileLock that acts as a guard of the lock. As long as it’s in scope, the exclusive lock will be held.
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 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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request