Function mozjs_sys::jsapi::JS_EncodeStringToBuffer
source ยท pub unsafe extern "C" fn JS_EncodeStringToBuffer(
cx: *mut JSContext,
str_: *mut JSString,
buffer: *mut c_char,
length: usize,
) -> bool
Expand description
Encode string into a buffer. The function does not stores an additional zero byte. The function returns (size_t) -1 if the string can not be encoded into bytes with no error reported. Otherwise it returns the number of bytes that are necessary to encode the string. If that exceeds the length parameter, the string will be cut and only length bytes will be written into the buffer.