Skip to main content

HostObject

Trait HostObject 

Source
pub trait HostObject: Sized {
    // Provided methods
    unsafe fn from_private(_cx: *mut JSContext, thisv: Value) -> *mut Self { ... }
    unsafe fn to_private(&self, obj: *mut JSObject) { ... }
}

Provided Methods§

Source

unsafe fn from_private(_cx: *mut JSContext, thisv: Value) -> *mut Self

Extract a native pointer from a JS object’s reserved slot 0.

§Safety

thisv must be a JS value containing a JSObject with a valid host pointer stored in reserved slot 0. @trace BCE-20260618-002 [level:regression]

Source

unsafe fn to_private(&self, obj: *mut JSObject)

Store a native pointer into a JS object’s reserved slot 0.

§Safety

obj must be a valid JSObject pointer with at least 1 reserved slot.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§