pub struct FullPermissionBuilder { /* private fields */ }Expand description
allows to construct a FullPermission object from a string representation of the permission.
§Example
use fmodeparser::FullPermissionBuilder;
use fmodeparser::FullPermissionError;
use std::error::Error;
let mut permission = FullPermissionBuilder::new()
.file_type('-')
.user("rw-")
.group("r--")
.other("r--")
.build()?;
assert_eq!(permission.to_string(), "-rw-r--r--");
assert_eq!(permission.get_mode(), 33188);
assert_eq!(permission.mode_as_octal(), "100644");
Ok(())Implementations§
Source§impl FullPermissionBuilder
impl FullPermissionBuilder
pub fn new() -> Self
Sourcepub fn user(&mut self, user: &str) -> &mut Self
pub fn user(&mut self, user: &str) -> &mut Self
accepts 3-character string representing the permission. examples : (---, rwx, r--)
§Panics
the permission must follow the regular expression ^[r-][w-][x-]$
Sourcepub fn group(&mut self, group: &str) -> &mut Self
pub fn group(&mut self, group: &str) -> &mut Self
accepts 3-character string representing the permission. examples : (---, rwx, r--)
§Panics
the permission must follow the regular expression ^[r-][w-][x-]$
Sourcepub fn other(&mut self, other: &str) -> &mut Self
pub fn other(&mut self, other: &str) -> &mut Self
accepts 3-character string representing the permission. examples : (---, rwx, r--)
§Panics
the permission must follow the regular expression ^[r-][w-][x-]$
Sourcepub fn build(&self) -> Result<FullPermission, FullPermissionError>
pub fn build(&self) -> Result<FullPermission, FullPermissionError>
returns either FullPermission object or FullPermissionError error .
Trait Implementations§
Source§impl Default for FullPermissionBuilder
impl Default for FullPermissionBuilder
Auto Trait Implementations§
impl Freeze for FullPermissionBuilder
impl RefUnwindSafe for FullPermissionBuilder
impl Send for FullPermissionBuilder
impl Sync for FullPermissionBuilder
impl Unpin for FullPermissionBuilder
impl UnwindSafe for FullPermissionBuilder
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more