The following pidfile program demonstrates how to create a PID file in Rust.
This zip file contains the complete crate.