Function nix::unistd::getpid

pub fn getpid() -> Pid
Documentation

Get the pid of this process (see getpid(2)).

Since you are running code, there is always a pid to return, so there is no error case that needs to be handled.