pub struct Mode(/* private fields */);
Expand description
The mode of a file.
The mode is stored in a 8-bit integer, with the following layout:
Read | Write |
---|---|
0 | 1 |
§Example
use file_system::Mode_type;
let mode = Mode_type::new(true, false);
assert_eq!(mode.get_read(), true);
assert_eq!(mode.get_write(), false);
let mode = Mode_type::new(false, true);
assert_eq!(mode.get_read(), false);
assert_eq!(mode.get_write(), true);
let mode = Mode_type::new(true, true);
assert_eq!(mode.get_read(), true);
assert_eq!(mode.get_write(), true);
Implementations§
Source§impl Mode
impl Mode
pub const READ_BIT: u8 = 1u8
pub const WRITE_BIT: u8 = 2u8
pub const SIZE: u8 = 2u8
pub const READ_ONLY: Self
pub const WRITE_ONLY: Self
pub const READ_WRITE: Self
pub const fn new(read: bool, write: bool) -> Self
pub const fn set_bit(self, mask: u8, value: bool) -> Self
pub const fn set_read(self, value: bool) -> Self
pub const fn set_write(self, value: bool) -> Self
pub const fn get_bit(&self, mask: u8) -> bool
pub const fn get_read(&self) -> bool
pub const fn get_write(&self) -> bool
pub const fn from_u8(value: u8) -> Self
pub const fn as_u8(&self) -> u8
Trait Implementations§
impl Copy for Mode
impl Eq for Mode
impl StructuralPartialEq for Mode
Auto Trait Implementations§
impl Freeze for Mode
impl RefUnwindSafe for Mode
impl Send for Mode
impl Sync for Mode
impl Unpin for Mode
impl UnwindSafe for Mode
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