pub struct ProtectionKeys { /* private fields */ }Expand description
Protection keys instance which is needed to create regions.
NOTE: You probably should always reuse it for creating regions because there are only 15 available keys in system
Implementations§
Source§impl ProtectionKeys
impl ProtectionKeys
Sourcepub fn is_supported() -> bool
pub fn is_supported() -> bool
Checks whether protection keys are supported.
See https://www.felixcloutier.com/x86/wrpkru
Sourcepub fn new(require_protected: bool) -> Result<Arc<Self>, ProtectionError>
pub fn new(require_protected: bool) -> Result<Arc<Self>, ProtectionError>
Creates protection keys instance.
Requirements to successfully create keys:
On failure will create a keys stub if require_protected is false,
returns an error otherwise.
Sourcepub fn make_region<T>(
self: &Arc<Self>,
initial: T,
) -> Result<Arc<ProtectedRegion<T>>, ProtectionError>where
T: Sized,
pub fn make_region<T>(
self: &Arc<Self>,
initial: T,
) -> Result<Arc<ProtectedRegion<T>>, ProtectionError>where
T: Sized,
Creates protected region.
Arc with protected keys is cloned so it is safe to keep only the region.
Trait Implementations§
Source§impl Default for ProtectionKeys
impl Default for ProtectionKeys
Source§fn default() -> ProtectionKeys
fn default() -> ProtectionKeys
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProtectionKeys
impl RefUnwindSafe for ProtectionKeys
impl Send for ProtectionKeys
impl Sync for ProtectionKeys
impl Unpin for ProtectionKeys
impl UnwindSafe for ProtectionKeys
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