pub struct Pid {
pub process_id: u32,
pub file_path: String,
/* private fields */
}Expand description
Represents a PID (Process ID) file.
The Pid structure provides functionality
for creating, reading, and managing a PID file,
which typically contains the process ID of
a running program.
Fields§
§process_id: u32process_id stored inside the file.
file_path: Stringpath of the file.
Implementations§
Source§impl Pid
impl Pid
Sourcepub fn new<T: Display>(path: T, name: T) -> Result<Self>
pub fn new<T: Display>(path: T, name: T) -> Result<Self>
Creates a new Pid instance with the specified file path and name.
§Arguments
path- The path where the PID file will be stored.name- The name of the PID file (without the extension).
§Errors
Returns an std::io::Error if the file cannot be opened, locked, or written.
§Examples
use filelock_rs::pid::Pid;
let pid = Pid::new("/var/run", "my_program").unwrap();Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pid
impl RefUnwindSafe for Pid
impl Send for Pid
impl Sync for Pid
impl Unpin for Pid
impl UnwindSafe for Pid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more