pub fn from_name(user: &str) -> Option<Passwd> {
        let c_user = CString::new(user).unwrap();

        let mut pwd: libc::passwd = unsafe { std::mem::zeroed() };
        let mut buf = Vec::with_capacity(getpw_r_size_max());
        let mut result = std::ptr::null_mut();
        unsafe {
            libc::getpwnam_r(c_user.as_ptr(),
                             &mut pwd,
                             buf.as_mut_ptr(),
                             buf.capacity(),
                             &mut result);
            result.as_ref().map(|p| Passwd::from_libc(p))
        }
    }
/// Gets a `Passwd` entry for the given username, or returns `None`
Gets a `Passwd` entry for the given username, or returns `None`
Gets a ` Passwd ` entry for the given username or returns ` None `
pub fn from_name(user: &str) -> Option<Passwd> {
        let c_user = CString::new(user).unwrap();
        let mut pwd: libc::passwd = unsafe { std::mem::zeroed() };
        let mut buf = Vec::with_capacity(getpw_r_size_max());
        let mut result = std::ptr::null_mut();
        unsafe {
            libc::getpwnam_r(c_user.as_ptr(),
                             &mut pwd,
                             buf.as_mut_ptr(),
                             buf.capacity(),
                             &mut result);
            result.as_ref().map(|p| Passwd::from_libc(p))
        }
    }
pub fn from_name ( user : & str ) -> Option < Passwd > { let c_user = CString :: new ( user ) . unwrap ( ) ; let mut pwd : libc :: passwd = unsafe { std :: mem :: zeroed ( ) } ; let mut buf = Vec :: with_capacity ( getpw_r_size_max ( ) ) ; let mut result = std :: ptr :: null_mut ( ) ; unsafe { libc :: getpwnam_r ( c_user . as_ptr ( ) , & mut pwd , buf . as_mut_ptr ( ) , buf . capacity ( ) , & mut result ) ; result . as_ref ( ) . map ( | p | Passwd :: from_libc ( p ) ) } }
Gets a `Passwd` entry for the given username, or returns `None`
Gets a ` Passwd ` entry for the given username or returns ` None `
user
&str
user
&str