Replace User fields with getters

The name() accessor is able to hide the fact that the user's actual name string is hidden in an Arc. (The Arc is still available, since it's needed for caching)
This commit is contained in:
Ben S
2016-01-28 15:04:22 +00:00
parent 305b37e8c2
commit fefddc4a76
7 changed files with 40 additions and 35 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ fn main() {
println!("Your UID is {}", current_uid);
let you = cache.get_user_by_uid(current_uid).expect("No entry for current user!");
println!("Your username is {}", you.name);
println!("Your username is {}", you.name());
let primary_group = cache.get_group_by_gid(you.primary_group).expect("No entry for your primary group!");
let primary_group = cache.get_group_by_gid(you.primary_group_id()).expect("No entry for your primary group!");
println!("Your primary group has ID {} and name {}", primary_group.gid, primary_group.name);
if primary_group.members.is_empty() {