[][src]Crate fslock

API to use files as a lock. Supports non-std crates by disabling feature std.

Types

Currently, only one type is provided: LockFile. It does not destroy the file after closed and behaviour on locking different file handles owned by the same process is different between Unix and Windows. # Example:

Example

use fslock::LockFile;
fn main() -> Result<(), fslock::Error> {

    let mut file = LockFile::open("mylock.test")?;
    file.lock()?;
    do_stuff();
    file.unlock()?;

    Ok(())
}

Structs

LockFile

A handle to a file that is lockable. Does not delete the file.

OsStr

Borrowed allocation of an OS-native string.

OsString

Owned allocation of an OS-native string.

Enums

EitherOsStr

Either borrowed or owned allocation of an OS-native string.

Traits

IntoOsString

Conversion of anything into an owned OS-native string. If allocation fails, an error shall be returned.

ToOsStr

Conversion of anything to an either borrowed or owned OS-native string. If allocation fails, an error shall be returned.

Type Definitions

Error

An IO error.