pub trait Lock<A: Zeroize + Bytes, PM: ProtectMode> {
// Required method
fn mlock(self) -> Result<Protected<A, PM, Locked>, Error>;
}Available on crate feature
protected only.Expand description
Protected region of memory that can be locked.
Required Methods§
Sourcefn mlock(self) -> Result<Protected<A, PM, Locked>, Error>
fn mlock(self) -> Result<Protected<A, PM, Locked>, Error>
Locks a region of memory, using mlock() on UNIX, or VirtualLock() on
Windows. By default, the protect mode is set to ReadWrite (i.e., no
exec) using mprotect() on UNIX, or VirtualProtect() on Windows.
On Linux, it will also set MADV_DONTDUMP using madvise().
§Errors
Returns error::Error::Io if the pages cannot be locked, for example
because the process has reached its locked-memory limit.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".