Expand description
Helpers that tend to be useful in other libraries as well.
Structs§
- Alloc
Guard - A RAII guard that owns a single allocation and ensures it is deallocated unless explicitly released.
- Slice
Alloc Guard - A RAII guard for a heap‐allocated slice that tracks how many elements have been initialized.
Functions§
- align_
up - Aligns the given value up to a non-zero alignment.
- align_
up_ ⚠unchecked - Aligns the given value up to an alignment.
- check_
ptr_ overlap - Checks if two pointers of to data of size
szoverlap. - checked_
op - Performs a checked arithmetic operation on two
usizes. - checked_
op_ panic - Performs a checked arithmetic operation on two
usizes. - checked_
op_ panic_ const - Performs a checked arithmetic operation on two
usizes. - dangling_
nonnull ⚠ - Returns a
NonNullwhich has the given alignment as its address. - dangling_
nonnull_ for - Returns a valid, dangling
NonNullfor the given layout. - layout_
extend - Given two layouts
aandb, computes a layout describing a block of memory that can hold a value of layoutafollowed by a value of layoutb, wherebstarts at an offset that satisfies its alignment. Returns the resulting combined layout and the offset at whichbbegins. - nonnull_
from_ ref - Converts a reference into a
NonNull. - nonnull_
slice_ from_ raw_ parts - Creates a
NonNull<[T]>from a pointer and a length. - nonnull_
slice_ ⚠len - Returns the length of a
NonNullslice pointer. - ptr_
max_ align - Returns the maximum alignment satisfied by a non-null pointer.
- slice_
ptr_ from_ raw_ parts - Creates a
*mut [T]from a pointer and a length.