Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brunoczim/fslock
File locking for Rust.
https://github.com/brunoczim/fslock
Last synced: 5 days ago
JSON representation
File locking for Rust.
- Host: GitHub
- URL: https://github.com/brunoczim/fslock
- Owner: brunoczim
- License: mit
- Created: 2019-12-30T05:49:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-18T16:52:22.000Z (3 months ago)
- Last Synced: 2024-10-13T01:36:37.867Z (about 1 month ago)
- Language: Rust
- Size: 8.39 MB
- Stars: 40
- Watchers: 4
- Forks: 11
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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, unless you activate the
`multilock` feature, which enables the `open_excl` method that locks files per
file descriptor/handle on all platforms.# Example
```rust
use fslock::LockFile;
fn main() -> Result<(), fslock::Error> {let mut file = LockFile::open("mylock")?;
file.lock()?;
do_stuff();
file.unlock()?;Ok(())
}
```# Docs on Master
https://brunoczim.github.io/fslock/fslock