Module utils

Source
Expand description

Miscellaneous minor utilities.

Macrosยง

default_union ๐Ÿ”’
Create a union value containing a default value in one of its arms.

Functionsยง

as_mut_ptr ๐Ÿ”’
Convert a &mut T into a *mut T without using an as.
as_ptr ๐Ÿ”’
Convert a &T into a *const T without using an as.
check_raw_pointer ๐Ÿ”’
Convert a *mut c_void to a *mut T, checking that it is not null, misaligned, or pointing to a region of memory that wraps around the address space.
option_as_mut_ptr ๐Ÿ”’
Convert an Option<&mut T> into a possibly-null *mut T.
option_as_ptr ๐Ÿ”’
Convert an Option<&T> into a possibly-null *const T.