Module lrs::mem

Memory operations.

Sub-modules

NameDescription
advice
flags

Types

KindNameDescription
Struct Availability

Availability of pages in memory.

Struct MemLockFlags

Flags for locking pages in memory.

Functions

NameDescription
addr

Returns the address of an object.

advise

Advise the kernel of a certain memory usage pattern.

align_for

Left-trims a byte slice so that the first element is aligned.

align_for_mut

Left-trims a mutable byte slice so that the first element is aligned.

align_of

Returns the alignment required for a type.

as_bytes

Returns the in-memory representation of an object.

as_mut_bytes

Returns the mutable in-memory representation of an object.

as_mut_slice

Turns a mutable reference into a mutable one-element slice.

as_slice

Turns a reference into a one-element slice.

availability

Checks whether pages are in memory or swapped out.

copy

Copies bytes from one slice to another.

copy_as

Copies an object and casts the result to another type.

drop

Drops a value.

forget

Destroys an object without running its destructor.

from_bytes

Turns a slice into a reference to a Pod type if it's suitable.

from_mut_bytes

Turns a mutable slice into a mutable reference to a Pod type if it's suitable.

is_suitable_for

Returns whether a buffer is suitable to hold an object of a certain type.

lock

Lock a memory range in memory.

lock_all

Lock all pages in memory.

needs_drop

Returns whether a type has a Drop implementation.

protect

Change the memory protection of a region.

replace

Replaces an object by another one.

size_of

Returns the size of an object.

swap

Swaps two objects.

transmute

Casts an object to another type.

Returns the same object but interpreted as an object of type U.

uninit

Creates an uninitialized object.

unlock

Unlock a memory range.

unlock_all

Unlock all pages in memory.

unsafe_copy

Copies bytes from one slice to another even if the type does not implement Copy.

unsafe_forget

Destroys an object without running its destructor even if the type does not implement Leak.

zeroed

Creates an object that has all bytes set to zero.