Skip to main content

JS_SetModulePrivateValue

Function JS_SetModulePrivateValue 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_SetModulePrivateValue( ctx: *mut JsContext, m: *mut JsModuleDef, val: JsValue, ) -> c_int
Expand description

JS_SetModulePrivateValue: attach a value to a C module.

val’s reference is consumed, as the header says. The value is stored in the definition, which is why it is an engine Value and not a boxed JSValue — the definition outlives the API call and must not depend on a reference count C cannot see.

§Safety

m must come from JS_NewCModule; val’s reference is consumed.