pub trait Lockable<A: Zeroize + Bytes> {
fn mlock(self) -> Result<Protected<A, ReadWrite, Locked>, Error>;
}
Available on crate feature
nightly
only.Expand description
A region of memory that can be locked, but is not yet protected. In order to lock the memory, it may require making a copy.
Required Methods
sourcefn mlock(self) -> Result<Protected<A, ReadWrite, Locked>, Error>
fn mlock(self) -> Result<Protected<A, ReadWrite, Locked>, Error>
Consumes self
, creates a new protected region of memory, and returns
the result in a heap-allocated, page-aligned region of memory. The
memory is locked with 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()
.