Trait bczhc_lib::libc::ToCString

source ·
pub trait ToCString {
    // Required method
    fn to_c_string(&self) -> CString;
}

Required Methods§

source

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();

Implementations on Foreign Types§

source§

impl ToCString for str

source§

impl ToCString for String

Implementors§