Skip to main content

JS_NewStringLen

Function JS_NewStringLen 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_NewStringLen( ctx: *mut JsContext, str1: *const c_char, len1: usize, ) -> JsValue
Expand description

JS_NewStringLen: a string from len1 bytes.

The bytes are WTF-8, not UTF-8, which is what lets a lone surrogate survive a round trip through C: JS_ToCStringLen2 emits the same three-byte form, and a host that stores a QuickJS string as bytes gets its characters back.

ยงSafety

str1 must point at len1 readable bytes.