pub enum MlockStatus {
Locked {
bytes_locked: usize,
},
Failed {
errno: i32,
},
Unsupported,
}Expand description
Result of a memory locking operation.
This type captures both successful and unsuccessful (but non-fatal) outcomes.
Fatal errors are returned as Err(MlockError).
Variants§
Locked
Memory was successfully locked.
Contains the number of bytes locked at the time of the call.
Note: This may increase as more memory is allocated (with MCL_FUTURE).
Failed
Memory locking failed but was not required.
Only returned when MlockConfig::required(false) is set.
The daemon should continue with a warning.
Unsupported
Memory locking is not supported on this platform.
Returned on non-Unix platforms (Windows, WASM, etc.).
Implementations§
Source§impl MlockStatus
impl MlockStatus
Sourcepub const fn is_locked(&self) -> bool
pub const fn is_locked(&self) -> bool
Check if memory is currently locked.
Returns true for MlockStatus::Locked, false otherwise.
Sourcepub const fn is_failed(&self) -> bool
pub const fn is_failed(&self) -> bool
Check if locking failed.
Returns true for MlockStatus::Failed, false otherwise.
Sourcepub const fn is_unsupported(&self) -> bool
pub const fn is_unsupported(&self) -> bool
Check if mlock is unsupported on this platform.
Returns true for MlockStatus::Unsupported, false otherwise.
Sourcepub const fn bytes_locked(&self) -> usize
pub const fn bytes_locked(&self) -> usize
Get the number of bytes locked.
Returns the bytes locked for MlockStatus::Locked, 0 otherwise.
Sourcepub const fn failure_errno(&self) -> Option<i32>
pub const fn failure_errno(&self) -> Option<i32>
Get the failure errno, if any.
Returns Some(errno) for MlockStatus::Failed, None otherwise.
Trait Implementations§
Source§impl Clone for MlockStatus
impl Clone for MlockStatus
Source§fn clone(&self) -> MlockStatus
fn clone(&self) -> MlockStatus
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more