Struct cchmod::Perm [−][src]
Expand description
File system object permissions.
Fields
read: bool
Flag indicating whether read permission is granted.
write: bool
Flag indicating whether write permission is granted.
execute: bool
Flag indicating whether execute permission is granted.
Implementations
Create a Perm
from its octal form, returning ParseError
if the input is invalid.
Examples
use cchmod::{Perm, ParseError}; assert_eq!(Perm::new(true, true, true), Perm::from_num("7").unwrap()); assert_eq!(Perm::new(true, false, false), Perm::from_num("4").unwrap()); assert_eq!( ParseError::UnexpectedEoi { pos: 0 }, Perm::from_num("").unwrap_err() ); assert_eq!( ParseError::UnexpectedChar { pos: 0, c: '8', expected: Some(vec!['0', '1', '2', '3', '4', '5', '6', '7']) }, Perm::from_num("8").unwrap_err() );
Create a Perm
from its symbolic form, returning ParseError
if the input is invalid.
Examples
use cchmod::{Perm, ParseError}; assert_eq!(Perm::new(true, true, true), Perm::from_sym_full("rwx").unwrap()); assert_eq!(Perm::new(true, false, false), Perm::from_sym_full("r--").unwrap()); assert_eq!( ParseError::UnexpectedEoi { pos: 2 }, Perm::from_sym_full("rw").unwrap_err() ); assert_eq!( ParseError::UnexpectedChar { pos: 3, c: 'r', expected: None }, Perm::from_sym_full("rwxr").unwrap_err() );
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Perm
impl UnwindSafe for Perm