python27-sys 0.7.0

FFI Declarations for Python 2.7
Documentation
1
2
3
4
5
6
7
8
9
10
11
unsafe fn get_str<'a>(s: *const libc::c_char) -> &'a str {
    let bytes = std::ffi::CStr::from_ptr(s).to_bytes();
    std::str::from_utf8(bytes).unwrap()
}

fn main() {
    unsafe {
        python27_sys::Py_Initialize();
        println!("{}", get_str(python27_sys::Py_GetVersion()));
    }
}