Function mozjs::rust::define_methods

source ·
pub unsafe fn define_methods(
    cx: *mut JSContext,
    obj: HandleObject<'_>,
    methods: &'static [JSFunctionSpec]
) -> Result<(), ()>
Expand description

Defines methods on obj. The last entry of methods must contain zeroed memory.

Failures

Returns Err on JSAPI failure.

Panics

Panics if the last entry of methods does not contain zeroed memory.

Safety

  • cx must be valid.
  • This function calls into unaudited C++ code.