pub enum ContextSource {
Owned(RefCell<Box<Context<'static>>>),
Attached,
}Expand description
Where a context’s interpreter comes from.
Variants§
Owned(RefCell<Box<Context<'static>>>)
A context that owns one (JS_NewContext). The RefCell is what lets the API’s
*mut JSContext be a shared reference: the alternative is one long-lived &mut per
entry point, which the re-entrant callback path would alias on every call.
Attached
A context that is whatever interpreter is current — the one a .so module’s
js_init_module runs against.
A native module is loaded from inside a running script, so its JSContext * has to
be the interpreter the engine is already inside. There is no second interpreter to
own, and owning one would be wrong: JS_GetOpaque and class registration have to
reach the same objects the importing script sees.
Auto Trait Implementations§
impl !Freeze for ContextSource
impl !RefUnwindSafe for ContextSource
impl !Send for ContextSource
impl !Sync for ContextSource
impl !UnwindSafe for ContextSource
impl Forget for ContextSource
impl Move for ContextSource
impl Unpin for ContextSource
impl UnsafeUnpin for ContextSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more