OxL Reference

data CString

Owned, NUL-terminated copy of a str for passing to C (const char *).

Example:

oxl✓ checked in CI
use std.ffi { CString }

fn main() io {
  let c: CString = "hello".toCString()
  print("{c.len()}")
}
Output
5
pub(api) data CString

Since. 1.0.0-beta

Methods

asPtr() -> *u8
Pointer to the first byte; valid while the CString is alive.
len() -> usize
Length without the terminating NUL.

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

See also