pub fn new(name: &str) -> Option<Self> {
		let c_name = CString::new(name).unwrap();
		// SAFETY: this is standard call to libc
		unsafe {
			let pwd = libc::getpwnam(c_name.as_ptr());
			if !pwd.is_null() {
				return Some(User {
					uid: (*pwd).pw_uid,
					gid: (*pwd).pw_gid,
				});
			} else {
				log::error!("Can't find user {}", name);
			}
		}
		None
	}
/// Try to create a User from a name
Try to create a User from a name
Try to create a User from a name
pub fn new(name: &str) -> Option<Self> {
		let c_name = CString::new(name).unwrap();
		// SAFETY: this is standard call to libc
		unsafe {
			let pwd = libc::getpwnam(c_name.as_ptr());
			if !pwd.is_null() {
				return Some(User {
					uid: (*pwd).pw_uid,
					gid: (*pwd).pw_gid,
				});
			} else {
				log::error!("Can't find user {}", name);
			}
		}
		None
	}
pub fn new ( name : & str ) -> Option < Self > { let c_name = CString :: new ( name ) . unwrap ( ) ; // SAFETY: this is standard call to libc unsafe { let pwd = libc :: getpwnam ( c_name . as_ptr ( ) ) ; if ! pwd . is_null ( ) { return Some ( User { uid : ( * pwd ) . pw_uid , gid : ( * pwd ) . pw_gid , } ) ; } else { log :: error ! ( " " name ) ; } } None }
Try to create a User from a name
Try to create a User from a name
name
&str
name
&str