pub struct MlockConfigBuilder { /* private fields */ }Expand description
Builder for MlockConfig.
§Example
use duende_mlock::MlockConfig;
let config = MlockConfig::builder()
.current(true)
.future(true)
.required(false)
.build();Implementations§
Source§impl MlockConfigBuilder
impl MlockConfigBuilder
Sourcepub const fn current(self, value: bool) -> Self
pub const fn current(self, value: bool) -> Self
Lock pages currently mapped (MCL_CURRENT).
Default: true
Sourcepub const fn future(self, value: bool) -> Self
pub const fn future(self, value: bool) -> Self
Lock pages mapped in the future (MCL_FUTURE).
Default: true
Sourcepub const fn required(self, value: bool) -> Self
pub const fn required(self, value: bool) -> Self
Whether mlock failure should return an error.
true(default): ReturnErr(MlockError)on failurefalse: ReturnOk(MlockStatus::Failed { .. })on failure
Use false when mlock is optional and the daemon should continue
with degraded safety guarantees.
Sourcepub const fn onfault(self, value: bool) -> Self
pub const fn onfault(self, value: bool) -> Self
Use on-fault locking (MCL_ONFAULT, Linux 4.4+).
When enabled, pages are locked only when they are first accessed (faulted in), rather than immediately. This reduces initial memory pressure for daemons with large potential address spaces.
Default: false
Ignored on platforms that don’t support it.
Sourcepub const fn build(self) -> MlockConfig
pub const fn build(self) -> MlockConfig
Build the configuration.
Trait Implementations§
Source§impl Clone for MlockConfigBuilder
impl Clone for MlockConfigBuilder
Source§fn clone(&self) -> MlockConfigBuilder
fn clone(&self) -> MlockConfigBuilder
Returns a duplicate of the value. Read more
1.0.0 · 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 MlockConfigBuilder
impl Debug for MlockConfigBuilder
Source§impl Default for MlockConfigBuilder
impl Default for MlockConfigBuilder
impl Copy for MlockConfigBuilder
Auto Trait Implementations§
impl Freeze for MlockConfigBuilder
impl RefUnwindSafe for MlockConfigBuilder
impl Send for MlockConfigBuilder
impl Sync for MlockConfigBuilder
impl Unpin for MlockConfigBuilder
impl UnwindSafe for MlockConfigBuilder
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