pub struct Permissions_type(/* private fields */);
Expand description
Represents the permissions of a file or directory.
The permissions are divided into three groups: user, group, and others. Each group has three permissions: read, write, and execute.
§Examples
use File_system::{Permissions_type, Permission_type, Special_type};
let user = Permission_type::New(true, false, false); // Read only
let group = Permission_type::New(false, true, false); // Write only
let others = Permission_type::New(false, false, true); // Execute only
let special = Special_type::New(true, false, true); // Sticky and set user identifier
let permissions = Permissions_type::New(user, group, others, special);
assert_eq!(permissions.Get_user(), user);
assert_eq!(permissions.Get_group(), group);
assert_eq!(permissions.Get_others(), others);
assert_eq!(permissions.Get_special(), special);
Implementations§
Source§impl Permissions_type
impl Permissions_type
pub const None: Self = _
pub const All_full: Self = _
pub const All_read_write: Self = _
pub const User_full: Self = _
pub const User_read_write: Self = _
pub const Executable: Self = _
Sourcepub const fn New(
User: Permission_type,
Group: Permission_type,
Others: Permission_type,
Special: Special_type,
) -> Self
pub const fn New( User: Permission_type, Group: Permission_type, Others: Permission_type, Special: Special_type, ) -> Self
Creates a new permission.
Sourcepub const fn New_default(Type: Type_type) -> Self
pub const fn New_default(Type: Type_type) -> Self
Creates a new permission with read access for user. No access for group and others.
Sourcepub fn Set_user(self, User: Permission_type) -> Self
pub fn Set_user(self, User: Permission_type) -> Self
Sets the permission for the user.
Sourcepub fn Set_group(self, Group: Permission_type) -> Self
pub fn Set_group(self, Group: Permission_type) -> Self
Sets the permission for the group.
Sourcepub fn Set_others(self, Others: Permission_type) -> Self
pub fn Set_others(self, Others: Permission_type) -> Self
Sets the permission for others.
Sourcepub fn Set_special(self, Special: Special_type) -> Self
pub fn Set_special(self, Special: Special_type) -> Self
Sets the special permissions.
Sourcepub fn Get_user(&self) -> Permission_type
pub fn Get_user(&self) -> Permission_type
Gets the permission for the user.
Sourcepub fn Get_group(&self) -> Permission_type
pub fn Get_group(&self) -> Permission_type
Gets the permission for the group.
Sourcepub fn Get_others(&self) -> Permission_type
pub fn Get_others(&self) -> Permission_type
Gets the permission for others.
Sourcepub fn Get_special(&self) -> Special_type
pub fn Get_special(&self) -> Special_type
Gets the special permissions.
Sourcepub const fn From_octal(Unix: u16) -> Option<Self>
pub const fn From_octal(Unix: u16) -> Option<Self>
Converts the permission to a Unix permission.
Trait Implementations§
Source§impl Clone for Permissions_type
impl Clone for Permissions_type
Source§fn clone(&self) -> Permissions_type
fn clone(&self) -> Permissions_type
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Permissions_type
impl Debug for Permissions_type
Source§impl Display for Permissions_type
impl Display for Permissions_type
Source§impl PartialEq for Permissions_type
impl PartialEq for Permissions_type
impl Copy for Permissions_type
impl Eq for Permissions_type
impl StructuralPartialEq for Permissions_type
Auto Trait Implementations§
impl Freeze for Permissions_type
impl RefUnwindSafe for Permissions_type
impl Send for Permissions_type
impl Sync for Permissions_type
impl Unpin for Permissions_type
impl UnwindSafe for Permissions_type
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more