pub struct LockedBox<T>(/* private fields */);
Expand description
A [Box
]-like type that uses mlock
to prevent paging the allocated memory
to disk.
Note: This type allocates in multiples of the operating system’s page size. This could lead to more memory usage than expected if many instances of this type are used.
Implementations§
Source§impl<T> LockedBox<T>
impl<T> LockedBox<T>
Sourcepub fn new(contained: T) -> Self
pub fn new(contained: T) -> Self
Creates a new locked box with contained
in a newly allocated,
mlock
-protected region of memory.
§Panics
This function panics if size_of::<T>() >= usize::MAX - 4 * PAGE_SIZE
or the underlying allocation fails.
Trait Implementations§
impl<T> Send for LockedBox<T>where
T: Send,
impl<T> Sync for LockedBox<T>where
T: Sync,
impl<T> UnwindSafe for LockedBox<T>where
T: UnwindSafe,
Auto Trait Implementations§
impl<T> Freeze for LockedBox<T>
impl<T> RefUnwindSafe for LockedBox<T>where
T: RefUnwindSafe,
impl<T> Unpin for LockedBox<T>
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