Function fz_string_content

Source
pub unsafe fn fz_string_content(fzstr: *mut fz_string_t) -> *const c_char
Expand description

Get the content of the string as a regular C string.

A string contianing NUL bytes will result in a NULL return value. In general, prefer fz_string_content_with_len except when it’s certain that the string is NUL-free.

The Null variant also results in a NULL return value.

This function takes the fz_string_t by pointer because it may be modified in-place to add a NUL terminator. The pointer must not be NULL.

§Safety

The returned string is “borrowed” and remains valid only until the fz_string_t is freed or passed to any other API function.

const char *fz_string_content(fz_string_t *);
Examples found in repository?
examples/kv.rs (line 336)
333    fn rstr(fzs: &mut kvstore_string_t) -> &str {
334        use std::ffi::CStr;
335        let content =
336            unsafe { CStr::from_ptr(kvstore_string_content(fzs as *mut kvstore_string_t)) };
337        content.to_str().unwrap()
338    }