2 ms·
> First, we store the Pointer of s string in a variable (p). > Then we use std::mem::forget to release it from the responsibility of Rust. CString::into_raw d
by masklinn 10y ago
> First, we store the Pointer of s string in a variable (p).
> Then we use std::mem::forget to release it from the responsibility of Rust.
CString::into_raw does that whole song and dance for you.
For Vectors you probably want to convert them to boxed slices first, at which point you can use Box::into_raw (to get the slice's head pointer).