pub trait CallbackContainer<D>where
D: DomTypes,{
// Required methods
unsafe fn new(cx: JSContext, callback: *mut JSObject) -> Rc<Self>;
fn callback_holder(&self) -> &CallbackObject<D>;
// Provided methods
fn callback(&self) -> *mut JSObject { ... }
fn incumbent(&self) -> Option<&<D as DomTypes>::GlobalScope> { ... }
}
Expand description
A trait to be implemented by concrete IDL callback function and callback interface types.
Required Methods§
Sourceunsafe fn new(cx: JSContext, callback: *mut JSObject) -> Rc<Self>
unsafe fn new(cx: JSContext, callback: *mut JSObject) -> Rc<Self>
Create a new CallbackContainer object for the given JSObject
.
§Safety
callback
must point to a valid, non-null JSObject.
Sourcefn callback_holder(&self) -> &CallbackObject<D>
fn callback_holder(&self) -> &CallbackObject<D>
Returns the underlying CallbackObject
.
Provided Methods§
Sourcefn incumbent(&self) -> Option<&<D as DomTypes>::GlobalScope>
fn incumbent(&self) -> Option<&<D as DomTypes>::GlobalScope>
Returns the “callback context”, that is, the global to use as incumbent global when calling the callback.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.