Skip to main content

haystack_value_get_str_value

Function haystack_value_get_str_value 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn haystack_value_get_str_value( val: *const Value, ) -> *const c_char
Expand description

Get the character of a Str Value

§Arguments

val A Str Value to get the C string from.

§Returns

The C string or null if there was an error, in which case the last_error_message can be called to get the error message.

§Example

let str = std::ffi::CString::new("foo bar").unwrap();
let val = haystack_value_make_str(str.as_ptr());
assert!(haystack_value_is_str(val));
let res = haystack_value_get_str_value(val) as *mut i8;
assert_eq!(std::ffi::CString::from_raw(res), str);

§Safety

Panics on invalid input data