pub struct Flags(/* private fields */);
Expand description
All the flags that can be set for a file.
The flags are stored in a 16-bit integer, with the following layout:
Mode | Open | Status |
---|---|---|
0-1 | 2-5 | 6-9 |
§Example
use file_system::{Flags_type, Mode_type, Open_type, Status_type};
let flags = Flags_type::new(Mode_type::Read_write, Some(Open_type::Create_only), Some(Status_type::Non_blocking));
assert_eq!(flags.get_mode(), Mode_type::Read_write);
assert_eq!(flags.get_open(), Open_type::Create_only);
assert_eq!(flags.get_status(), Status_type::Non_blocking);
Implementations§
Source§impl Flags
impl Flags
pub const fn new(mode: Mode, open: Option<Open>, status: Option<Status>) -> Self
pub const fn get_mode(&self) -> Mode
pub const fn get_open(&self) -> Open
pub const fn get_status(&self) -> Status
pub const fn set_mode(self, mode: Mode) -> Self
pub const fn set_open(self, open: Open) -> Self
pub const fn set_status(self, status: Status) -> Self
pub fn is_permission_granted(&self, permission: &Permission) -> bool
Trait Implementations§
impl Copy for Flags
impl Eq for Flags
impl StructuralPartialEq for Flags
Auto Trait Implementations§
impl Freeze for Flags
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnwindSafe for Flags
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