Module mem

Source
Expand description

Memory management.
mem::{cell}

Extends: std::{alloc, borrow, boxed, cell, mem, pin, ptr, rc, slice}


Modules§

cell
Shareable mutable containers.

Macros§

addr_of
core Create a const raw pointer to a place, without creating an intermediate reference.
addr_of_mut
core Create a mut raw pointer to a place, without creating an intermediate reference.
cswap
Swaps two mutable variables in a compile-time friendly manner.
offset_of
core Expands to the offset in bytes of a field from the beginning of the given type.
pin
core Constructs a Pin<&mut T>, by pinning a value: T locally.
size_of_expr
Returns the size of an expression in bytes.

Structs§

Alloc
🌐 Memory-allocation-related operations.
BareBox
A no-op pointer type, like a Box but without affecting how T is stored.
Boxalloc
alloc A pointer type that uniquely owns a heap allocation of type T.
Boxedalloc
A zero-sized marker for a Storage type that wraps its data in a Box.
CacheAlign
Aligns and pads a value to the length of a cache line.
Currentstd and unsafe_layout
A marker object representing the current instance of a type T.
CurrentGuardstd and unsafe_layout
A guard that temporarily sets a global current pointer for T, restoring the old one on drop.
Discriminant
core Opaque type representing the discriminant of an enum.
FatPtr
Represents a fat pointer with separate data and metadata pointers.
ManuallyDrop
core A wrapper to inhibit compiler from automatically calling T’s destructor.
Mem
🌐 Memory-related operations.
MemLayoutalloc
alloc Layout of a block of memory.
MemLayoutErroralloc
🚩 alloc The MemLayout parameters violated constraints.
Pin
core A pointer which pins its pointee in place.
Pinnedunsafe_ptr
A wrapper for structurally pinned data.
Ptr
🌐 Pointer-related operations.
PtrNonNull
core *mut T but non-zero and covariant.
Rcalloc
alloc A single-threaded reference-counting pointer.
RcWeakalloc
alloc A version of Rc that holds a non-owning reference to the managed allocation.
Slice
🌐 Slice-related operations, most of them const.
SystemAllocstd
std The default memory allocator provided by the operating system.

Enums§

Cowalloc
alloc A clone-on-write smart pointer.

Traits§

BitSized
Type size information in bits.
Borrow
core A trait for borrowing data.
BorrowMut
core A trait for mutably borrowing data.
ByteSized
Type size information in bytes.
ExtMem
🌐 Extension trait for type memory information and manipulation.
ExtSlice
🌐 Extension trait providing additional methods for &[T].
ExtSliceMut
🌐 Extension trait providing additional methods for &mut [T].
GlobalAllocalloc
alloc A memory allocator that can be registered as the standard library’s default.
MemAligned
Marker trait to verify memory alignment between two types.
MemPodunsafe_layout
Indicates a type is Plain Old Data, and meets specific memory layout guarantees.
Sized
core Types with a constant size known at compile time.
Storage
Allows to be generic in respect of the data storage.
ToOwnedalloc
alloc A generalization of Clone to borrowed data.

Functions§

transmuteDeprecated
core Reinterprets the bits of a value of one type as another type.

Type Aliases§

Bare
core A zero-sized marker for a Storage type that wraps its data in a BareBox.

Unions§

MaybeUninit
core A wrapper type to construct uninitialized instances of T.