MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / get_str

Function get_str

python3-sys/examples/version.rs:1–4  ·  view source on GitHub ↗
(s: *const libc::c_char)

Source from the content-addressed store, hash-verified

1unsafe fn get_str<'a>(s: *const libc::c_char) -> &'a str {
2 let bytes = std::ffi::CStr::from_ptr(s).to_bytes();
3 std::str::from_utf8(bytes).unwrap()
4}
5
6fn main() {
7 unsafe {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected