You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
use core::fmt::Debug;
|
|
|
|
/// Convert C string to Rust string
|
|
pub unsafe fn from_cstr(s: *const u8) -> &'static str {
|
|
use core::{str, slice};
|
|
let len = (0usize..).find(|&i| *s.offset(i as isize) == 0).unwrap();
|
|
str::from_utf8(slice::from_raw_parts(s, len)).unwrap()
|
|
}
|