Function rsvg::util::utf8_cstr

source ·
pub unsafe fn utf8_cstr<'a>(s: *const c_char) -> &'a str
Expand description

Converts a char * which is known to be valid UTF-8 into a &str

The usual from_glib_none(s) allocates an owned String. The purpose of utf8_cstr() is to get a temporary string slice into a C string which is already known to be valid UTF-8; for example, as for strings which come from libxml2.

Safety: s must be a nul-terminated, valid UTF-8 string of bytes.