get_string

Function get_string 

pub unsafe fn get_string(
    max_len: usize,
    getter: impl FnOnce(*mut c_char, usize) -> Result<()>,
) -> Result<String>
Expand description

Reads a null-terminated string from a function.

§Safety

This function is safe to call IFF the getter function fulfills the following requirements:

  • The function must return 0 on success, and a non-zero value on failure.
  • Success implies the function has written a null-terminated string to its first argument (“the buffer”).
  • The function must not write more than the amount of bytes specified in the first argument to the buffer.