pub struct Protection(/* private fields */);Expand description
Represents memory protection flags.
This structure encapsulates read, write, and execute permissions for memory regions in a compact bit representation.
Implementations§
Source§impl Protection
impl Protection
Sourcepub const EXECUTE_BIT: u8
pub const EXECUTE_BIT: u8
Bit flag representing execute permission.
Sourcepub const NONE: Protection
pub const NONE: Protection
No memory access permissions.
Sourcepub const READ: Protection
pub const READ: Protection
Read-only memory access.
Sourcepub const WRITE: Protection
pub const WRITE: Protection
Write-only memory access.
Sourcepub const EXECUTE: Protection
pub const EXECUTE: Protection
Execute-only memory access.
Sourcepub const READ_WRITE: Protection
pub const READ_WRITE: Protection
Read and write memory access.
Sourcepub const READ_EXECUTE: Protection
pub const READ_EXECUTE: Protection
Read and execute memory access.
Sourcepub const WRITE_EXECUTE: Protection
pub const WRITE_EXECUTE: Protection
Write and execute memory access.
Sourcepub const READ_WRITE_EXECUTE: Protection
pub const READ_WRITE_EXECUTE: Protection
Full memory access (read, write, and execute).
Sourcepub const fn set_read(self, value: bool) -> Protection
pub const fn set_read(self, value: bool) -> Protection
Sourcepub const fn set_write(self, value: bool) -> Protection
pub const fn set_write(self, value: bool) -> Protection
Sourcepub const fn set_execute(self, value: bool) -> Protection
pub const fn set_execute(self, value: bool) -> Protection
Sourcepub const fn get_write(&self) -> bool
pub const fn get_write(&self) -> bool
Checks if write permission is granted.
§Returns
true if write permission is granted, false otherwise.
Sourcepub const fn get_execute(&self) -> bool
pub const fn get_execute(&self) -> bool
Checks if execute permission is granted.
§Returns
true if execute permission is granted, false otherwise.
Trait Implementations§
Source§impl Clone for Protection
impl Clone for Protection
Source§fn clone(&self) -> Protection
fn clone(&self) -> Protection
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Protection
impl Debug for Protection
Source§impl From<u8> for Protection
impl From<u8> for Protection
Source§fn from(protection: u8) -> Protection
fn from(protection: u8) -> Protection
Converts to this type from the input type.
Source§impl PartialEq for Protection
impl PartialEq for Protection
Source§fn eq(&self, other: &Protection) -> bool
fn eq(&self, other: &Protection) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for Protection
impl Eq for Protection
impl StructuralPartialEq for Protection
Auto Trait Implementations§
impl Freeze for Protection
impl RefUnwindSafe for Protection
impl Send for Protection
impl Sync for Protection
impl Unpin for Protection
impl UnsafeUnpin for Protection
impl UnwindSafe for Protection
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