Struct redox_users::AllGroups

source ·
pub struct AllGroups { /* private fields */ }
Expand description

AllGroups provides (borrowed) access to all groups on the system. Note that this struct implements All for all of its access functions.

General notes that also apply to this struct may be found with AllUsers.

Implementations§

source§

impl AllGroups

source

pub fn new(config: Config) -> Result<AllGroups, Error>

Create a new AllGroups.

source

pub fn add_group(&mut self, builder: GroupBuilder) -> Result<&Group, Error>

Consumes a builder, adding a new group to this AllGroups. Returns a reference to the created Group.

Make sure to call AllGroups::save in order for the new group to be applied to the system.

§Defaults

If a builder is not passed a group id (GroupBuilder::gid) before being passed to this function, AllGroups::get_unique_id is used.

If the builder is not passed any users (GroupBuilder::user), the group will still be created.

source

pub fn save(&mut self) -> Result<(), Error>

Syncs the data stored in this AllGroups instance to the filesystem. To apply changes from an AllGroups, you MUST call this function!

Trait Implementations§

source§

impl All for AllGroups

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. Read more
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. Read more
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. Read more
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.
source§

impl Debug for AllGroups

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.