Trait redox_users::All

source ·
pub trait All: AllInner {
    // Provided methods
    fn iter(&self) -> Iter<'_, <Self as AllInner>::Gruser> { ... }
    fn iter_mut(&mut self) -> IterMut<'_, <Self as AllInner>::Gruser> { ... }
    fn get_by_name(
        &self,
        name: impl AsRef<str>
    ) -> Option<&<Self as AllInner>::Gruser> { ... }
    fn get_mut_by_name(
        &mut self,
        name: impl AsRef<str>
    ) -> Option<&mut <Self as AllInner>::Gruser> { ... }
    fn get_by_id(&self, id: usize) -> Option<&<Self as AllInner>::Gruser> { ... }
    fn get_mut_by_id(
        &mut self,
        id: usize
    ) -> Option<&mut <Self as AllInner>::Gruser> { ... }
    fn get_unique_id(&self) -> Option<usize> { ... }
    fn remove_by_name(&mut self, name: impl AsRef<str>) -> bool { ... }
    fn remove_by_id(&mut self, id: usize) -> bool { ... }
}
Expand description

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§

source

fn iter(&self) -> Iter<'_, <Self as AllInner>::Gruser>

Get an iterator borrowing all Users or Groups on the system.

source

fn iter_mut(&mut self) -> IterMut<'_, <Self as AllInner>::Gruser>

Get an iterator mutably borrowing all Users or Groups on the system.

source

fn get_by_name( &self, name: impl AsRef<str> ) -> Option<&<Self as AllInner>::Gruser>

Borrow the User or Group with a given name.

§Examples

Basic usage:

let users = AllUsers::basic(Config::default()).unwrap();
let user = users.get_by_name("root").unwrap();
source

fn get_mut_by_name( &mut self, name: impl AsRef<str> ) -> Option<&mut <Self as AllInner>::Gruser>

Mutable version of All::get_by_name.

source

fn get_by_id(&self, id: usize) -> Option<&<Self as AllInner>::Gruser>

Borrow the User or Group with the given ID.

§Examples

Basic usage:

let users = AllUsers::basic(Config::default()).unwrap();
let user = users.get_by_id(0).unwrap();
source

fn get_mut_by_id( &mut self, id: usize ) -> Option<&mut <Self as AllInner>::Gruser>

Mutable version of All::get_by_id.

source

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::basic(Config::default()).unwrap();
let uid = users.get_unique_id().expect("no available uid");
source

fn remove_by_name(&mut self, name: impl AsRef<str>) -> bool

Remove a User or Group from this All given it’s name. If the Gruser was removed return true, else return false. This ensures that the Gruser no longer exists.

source

fn remove_by_id(&mut self, id: usize) -> bool

Id version of All::remove_by_name.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl All for AllGroups

source§

impl<A> All for AllUsers<A>