pub struct NamedLock { /* private fields */ }
Expand description

Cross-process lock that is identified by name.

Implementations

Create/open a named lock.

UNIX

This will create/open a file and use flock on it. The path of the lock file will be $TMPDIR/<name>.lock, or /tmp/<name>.lock if TMPDIR environment variable is not set.

If you want to specify the exact path, then use NamedLock::with_path.

Windows

This will create/open a global mutex with CreateMutexW.

Notes
  • name must not be empty, otherwise an error is returned.
  • name must not contain \0, /, nor \, otherwise an error is returned.
Available on Unix only.

Create/open a named lock on specified path.

Notes
  • This function does not append .lock on the path.
  • Parent directories must exist.

Try to lock named lock.

If it is already locked, Error::WouldBlock will be returned.

Lock named lock.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.