printers 2.3.0

Get printers and print files on unix and windows
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use libc::c_char;
use std::ffi::{CStr, CString};

pub fn c_char_to_string(value: *const c_char) -> String {
    if !value.is_null() {
        let cstr = unsafe { CStr::from_ptr(value) };
        cstr.to_string_lossy().to_string()
    } else {
        "".to_string()
    }
}

pub fn str_to_cstring(value: &str) -> CString {
    let c_string = CString::new(value);
    c_string.unwrap_or_default()
}