Skip to content

Commit

Permalink
Add doc aliases for getpw{nam,uid} (#2560)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored Dec 12, 2024
1 parent 5c80884 commit c017285
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3732,6 +3732,7 @@ impl User {
/// let res = User::from_uid(Uid::from_raw(0)).unwrap().unwrap();
/// assert_eq!(res.name, "root");
/// ```
#[doc(alias("getpwuid", "getpwuid_r"))]
pub fn from_uid(uid: Uid) -> Result<Option<Self>> {
// SAFETY: `getpwuid_r` will write to `res` if it initializes the value
// at `pwd`.
Expand All @@ -3755,6 +3756,7 @@ impl User {
/// let res = User::from_name("root").unwrap().unwrap();
/// assert_eq!(res.name, "root");
/// ```
#[doc(alias("getpwnam", "getpwnam_r"))]
pub fn from_name(name: &str) -> Result<Option<Self>> {
let name = match CString::new(name) {
Ok(c_str) => c_str,
Expand Down

0 comments on commit c017285

Please sign in to comment.