Function from_cstring_raw

Source
pub unsafe fn from_cstring_raw(cstring: *const c_char) -> String
Expand description

Creates an owned String from a given raw C string pointer.

ยงSafety

This function assumes that the string is a valid C string with a null terminator. Passing a pointer which does not refer to such a string will result in undefined behaviour.

The function does not take responsibility for the C string after reading from it; managing allocation and lifetime is up to the caller.