OxL Reference

method T.offset

Pointer n elements further (negative n goes back). No bounds check.

Example:

oxl✓ checked in CI
fn main() io {
  let s = "abc".toCString()
  let second = unsafe { s.asPtr().offset(1).read() }
  print("{second}")
}
Output
98
pub(api) move unsafe fn offset(n: isize) -> *T

Since. 1.0.0-beta

Parameters

NameType
nisize

Returns

*T

Effects

none declared (pure unless the body says otherwise)

Defined in: std/ffi/ffi.oxl:278

See also