/dotlock

Rust library to create .lock files

Primary LanguageRust

dotlock

Crate Build Status

This crate contains support for creating lock files as are used on various UNIX type systems. This is similar to the lockfile program from procmail or the dotlockfile program from liblockfile.

Documentation

Usage

Add this to your Cargo.toml:

[dependencies]
dotlock = "0"

...and this to your crate root:

extern crate dotlock;

Example

extern crate dotlock;
use std::fs::File;
use std::io::{Write, Read, Seek, SeekFrom};

fn main() {
    let mut lock = dotlock::Dotlock::create("some.file.lock").unwrap();
    writeln!(lock, "Do not touch this file!").unwrap();
}