Created
July 6, 2015 02:07
-
-
Save mfpiccolo/3d0f3886318d8017f521 to your computer and use it in GitHub Desktop.
Converting Rust Ruby methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn ruby_string_to_ref_str<'a>(r_string: *const libc::c_char) -> &'a str { | |
unsafe { CStr::from_ptr(r_string) }.to_str().unwrap() | |
} | |
fn string_to_ruby_string(string: String) -> *const libc::c_char { | |
CString::new(string).unwrap().into_ptr() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment