Function fz_string_clone

Source
pub unsafe fn fz_string_clone(cstr: *const c_char) -> fz_string_t
Expand description

Create a new fz_string_t by cloning the content of the given C string. The resulting fz_string_t is independent of the given string.

ยงSafety

The given pointer must not be NULL. The resulting fz_string_t must be freed.

fz_string_t fz_string_clone(const char *);
Examples found in repository?
examples/kv.rs (line 329)
326    fn fzstr(s: &str) -> kvstore_string_t {
327        use std::ffi::CString;
328        let cstr = CString::new(s).unwrap();
329        unsafe { kvstore_string_clone(cstr.as_ptr()) }
330    }