pointer_to_string

Function pointer_to_string 

Source
pub unsafe fn pointer_to_string(pointer: *const c_char) -> String
Expand description

Unsafe strings conversion function.

Converts a *const libc::c_char to an owned String. Useful for log callbacks.

ยงExample

Standard usage may be for the log callbacks.

extern "C" fn default_log_callback(log_type: LogType, text: *const libc::c_char) {
    let string = unsafe { pointer_to_string(text) };
    println!("wlc [{:?}]: {}", log_type, string);
}