pub trait ToCString {
// Required method
fn to_c_string(&self) -> CString;
}Required Methods§
sourcefn to_c_string(&self) -> CString
fn to_c_string(&self) -> CString
As a string pointer in C, for libc FFI.
Examples
use bczhc_lib::libc::ToCString;
let heap_str = String::from("abc");
let stack_str = "cba";
heap_str.to_c_string().as_ptr();
stack_str.to_c_string().as_ptr();