Rawpointer adds extra utility methods to raw pointers *const T
, *mut T
and NonNull<T>
.
Features include:
-
Strided offsets -
.stride_offset(stride, index)
make it easy to compute pointer offsets where the index is unsigned and the stride is signed. -
Offsetting methods in general for
NonNull
, since it does not have these from libcore -
Post- and preincrement and post- and predecrement methods
-
For
p++
usep.post_inc()
. -
For
++p
usep.pre_inc()
. -
For
p--
usep.post_dec()
. -
For
--p
usep.pre_dec()
.
use PointerExt;
unsafe
Safety
See the Rust [core::ptr] documentation for more information.
Rust Version
This version of the crate requires Rust 1.26 or later