FullPermission

Struct FullPermission 

Source
pub struct FullPermission { /* private fields */ }
Expand description

a struct that represents a file permission for the file kind and the three owner kinds

allows easily access, modify and convert the permission to a string representation

see the example for more details. new

Implementations§

Source§

impl FullPermission

Source

pub fn new(mode: u32) -> Result<Self, FullPermissionError>

accepts valid decimal digit represents the file permission.

returns either instance of the struct or an FullPermissionError Result.

§Example
 use fmodeparser::FullPermission;

 let mode_number = 33188;
 let full_permission = FullPermission::new(mode_number)?;
Source

pub fn get_file_type(&self) -> char

returns character representing the file type. example: - for a regular file

Source

pub fn get_user(&mut self) -> &mut OwnersKind

returns the user owner that gives you the full authority to modify this owner kind.

Source

pub fn get_group(&mut self) -> &mut OwnersKind

returns the group owner that gives you the full authority to modify this owner kind.

Source

pub fn get_other(&mut self) -> &mut OwnersKind

returns the other owner that gives you the full authority to modify this owner kind.

Source

pub fn get_mode(&mut self) -> u32

returns the mode of the file converted from octal to decimal.

Also it can be reused again to construct a new FullPermission object.

Source

pub fn mode_as_octal(&mut self) -> String

returns the mode as an octal number string.

this is not meant to be used to be bypassed within the crate !! only for representation.

Trait Implementations§

Source§

impl Debug for FullPermission

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for FullPermission

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for FullPermission

Source§

fn eq(&self, other: &FullPermission) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for FullPermission

Source§

impl StructuralPartialEq for FullPermission

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.