wasmer_types::lib::std::ptr

Function dangling

1.85.0 (const: 1.85.0) · Source
pub const fn dangling<T>() -> *const T
Available on crate feature std only.
Expand description

Creates a new pointer that is dangling, but non-null and well-aligned.

This is useful for initializing types which lazily allocate, like Vec::new does.

Note that the pointer value may potentially represent a valid pointer to a T, which means this must not be used as a “not yet initialized” sentinel value. Types that lazily allocate must track initialization by some other means.