[−][src]Trait redox_users::All
This trait is used to remove repetitive API items from
AllGroups
and AllUsers
. It uses a hidden trait
so that the implementations of functions can be implemented
at the trait level. Do not try to implement this trait.
Provided methods
fn iter(&self) -> Iter<Self::Gruser>
fn iter_mut(&mut self) -> IterMut<Self::Gruser>
fn get_by_name(
&self,
name: impl AsRef<str>
) -> Option<&Self::Gruser>
&self,
name: impl AsRef<str>
) -> Option<&Self::Gruser>
Borrow the User
or Group
with a given name.
Examples
Basic usage:
let users = AllUsers::new(Config::default()).unwrap(); let user = users.get_by_name("root").unwrap();
fn get_mut_by_name(
&mut self,
name: impl AsRef<str>
) -> Option<&mut Self::Gruser>
&mut self,
name: impl AsRef<str>
) -> Option<&mut Self::Gruser>
Mutable version of get_by_name
.
fn get_by_id(&self, id: usize) -> Option<&Self::Gruser>
Borrow the User
or Group
with the given ID.
Examples
Basic usage:
let users = AllUsers::new(Config::default()).unwrap(); let user = users.get_by_id(0).unwrap();
fn get_mut_by_id(&mut self, id: usize) -> Option<&mut Self::Gruser>
Mutable version of get_by_id
.
fn get_unique_id(&self) -> Option<usize>
Provides an unused id based on the min and max values in
the Config
passed to the All
's constructor.
Examples
let users = AllUsers::new(Config::default()).unwrap(); let uid = users.get_unique_id().expect("no available uid");
fn remove_by_name(
&mut self,
name: impl AsRef<str>
)
&mut self,
name: impl AsRef<str>
)
Remove a User
or Group
from this All
given it's name. This won't provide an indication
of whether the user was removed or not, but is guaranteed to work
if a user with the specified name exists.
fn remove_by_id(&mut self, id: usize)
Id version of remove_by_name
.
Implementors
impl All for AllGroups
[src]
fn iter(&self) -> Iter<Self::Gruser>
[src]
fn iter_mut(&mut self) -> IterMut<Self::Gruser>
[src]
fn get_by_name(
&self,
name: impl AsRef<str>
) -> Option<&Self::Gruser>
[src]
&self,
name: impl AsRef<str>
) -> Option<&Self::Gruser>
fn get_mut_by_name(
&mut self,
name: impl AsRef<str>
) -> Option<&mut Self::Gruser>
[src]
&mut self,
name: impl AsRef<str>
) -> Option<&mut Self::Gruser>
fn get_by_id(&self, id: usize) -> Option<&Self::Gruser>
[src]
fn get_mut_by_id(&mut self, id: usize) -> Option<&mut Self::Gruser>
[src]
fn get_unique_id(&self) -> Option<usize>
[src]
fn remove_by_name(
&mut self,
name: impl AsRef<str>
)
[src]
&mut self,
name: impl AsRef<str>
)
fn remove_by_id(&mut self, id: usize)
[src]
impl All for AllUsers
[src]
fn iter(&self) -> Iter<Self::Gruser>
[src]
fn iter_mut(&mut self) -> IterMut<Self::Gruser>
[src]
fn get_by_name(
&self,
name: impl AsRef<str>
) -> Option<&Self::Gruser>
[src]
&self,
name: impl AsRef<str>
) -> Option<&Self::Gruser>
fn get_mut_by_name(
&mut self,
name: impl AsRef<str>
) -> Option<&mut Self::Gruser>
[src]
&mut self,
name: impl AsRef<str>
) -> Option<&mut Self::Gruser>
fn get_by_id(&self, id: usize) -> Option<&Self::Gruser>
[src]
fn get_mut_by_id(&mut self, id: usize) -> Option<&mut Self::Gruser>
[src]
fn get_unique_id(&self) -> Option<usize>
[src]
fn remove_by_name(
&mut self,
name: impl AsRef<str>
)
[src]
&mut self,
name: impl AsRef<str>
)