Module utils

Source
Expand description

Utility functions.

Structs§

PanicInfo
Information about a panic, used in ffi_panic_message.

Functions§

distance_from
This function allows calculating the distance (in Ts) from from to to.
ffi_panic_message
Prints an error message for attempting to panic across the ffi boundary and aborts the process.
leak_value
Leaks value into the heap, and returns a reference to it.
manuallydrop_as_raw_mut
Casts a &'a mut ManuallyDrop<T> to *mut T
manuallydrop_as_rmut
Casts a &'a mut ManuallyDrop<T> to RMut<'a, T>
ref_as_nonnull
Converts a &T to a NonNull<T>.
take_manuallydrop
Takes the contents out of a ManuallyDrop<T>.
transmute_mut_reference
Transmute a mutable reference to another mutable reference, changing the referent’s type.
transmute_reference
Transmute a reference to another reference, changing the referent’s type.

Unions§

Transmuter
Helper type for transmuting between Copy types without adding any overhead in debug builds.