Function lrs::intrinsics::offset

Creates a pointer by calculating an offset from another one.

Syntax

unsafe extern "rust-intrinsic" fn offset<T>(dst: *const T, offset: isize) -> *const T

Arguments

NameDescription
dst

The original pointer.

offset

The offset to be added to the original pointer.

Return value

Returns the offset pointer.

Remarks

The offset argument is in units of T, not in byte units. If dst is not a valid pointer, or dst + offset does not point into the same object, or dst + offset overflows, the behavior is undefined.

Using this function instead of casting to integers can enable more optimizations.