Struct josephine::context::JSContext
[−]
[src]
pub struct JSContext<S> { /* fields omitted */ }
The type for JS contexts whose current state is S
.
Methods
impl JSContext<Owned>
[src]
impl<S> JSContext<S>
[src]
fn snapshot<'a>(&'a mut self) -> JSContext<Snapshotted<'a, S>>
[src]
Get a snapshot of the JS state. The snapshot only allows access to the methods that are guaranteed not to call GC, so we don't need to root JS-managed pointers during the lifetime of a snapshot.
fn enter_known_compartment<'a, 'b, C, T>(
&'a mut self,
managed: JSManaged<'b, C, T>
) -> JSContext<Entered<'a, C, T::Aged, S>> where
T: JSLifetime<'a>,
C: Compartment,
[src]
&'a mut self,
managed: JSManaged<'b, C, T>
) -> JSContext<Entered<'a, C, T::Aged, S>> where
T: JSLifetime<'a>,
C: Compartment,
Enter a known compartment.
fn enter_unknown_compartment<'a, 'b, C, T>(
&'a mut self,
managed: JSManaged<'b, C, T>
) -> JSContext<Entered<'a, BOUND<'a>, T::Aged, S>> where
T: JSLifetime<'a>,
[src]
&'a mut self,
managed: JSManaged<'b, C, T>
) -> JSContext<Entered<'a, BOUND<'a>, T::Aged, S>> where
T: JSLifetime<'a>,
Enter a compartment.
fn manage<'a, C, T>(&'a mut self, value: T) -> JSManaged<'a, C, T::Aged> where
S: CanAlloc + InCompartment<C>,
C: Compartment,
T: JSTraceable + JSInitializable + JSLifetime<'a>,
[src]
S: CanAlloc + InCompartment<C>,
C: Compartment,
T: JSTraceable + JSInitializable + JSLifetime<'a>,
Give ownership of data to JS. This allocates JS heap, which may trigger GC.
fn snapshot_manage<'a, C, T>(
&'a mut self,
value: T
) -> (JSContext<Snapshotted<'a, S>>, JSManaged<'a, C, T::Aged>) where
S: CanAlloc + InCompartment<C>,
C: Compartment,
T: JSTraceable + JSInitializable + JSLifetime<'a>,
[src]
&'a mut self,
value: T
) -> (JSContext<Snapshotted<'a, S>>, JSManaged<'a, C, T::Aged>) where
S: CanAlloc + InCompartment<C>,
C: Compartment,
T: JSTraceable + JSInitializable + JSLifetime<'a>,
Give ownership of data to JS. This allocates JS heap, which may trigger GC.
fn create_compartment<'a, T>(
&'a mut self
) -> JSContext<Initializing<'a, BOUND<'a>, T>> where
S: CanAlloc + CanAccess,
T: JSInitializable + JSTraceable,
[src]
&'a mut self
) -> JSContext<Initializing<'a, BOUND<'a>, T>> where
S: CanAlloc + CanAccess,
T: JSInitializable + JSTraceable,
Create a compartment
fn global_manage<'a, C, T>(
self,
value: T
) -> JSContext<Initialized<'a, C, T::Aged>> where
S: IsInitializing<'a, C, T>,
T: JSTraceable + JSLifetime<'a> + JSCompartmental<C, C, ChangeCompartment = T>,
[src]
self,
value: T
) -> JSContext<Initialized<'a, C, T::Aged>> where
S: IsInitializing<'a, C, T>,
T: JSTraceable + JSLifetime<'a> + JSCompartmental<C, C, ChangeCompartment = T>,
Finish initializing a JS Context
fn entered<'a, C, T>(&self) -> JSManaged<'a, C, T> where
S: IsEntered<'a, C, T>,
[src]
S: IsEntered<'a, C, T>,
Get the object we entered the current compartment via
fn global<'a, C, T>(&self) -> JSManaged<'a, C, T> where
S: IsInitialized<'a, C, T>,
[src]
S: IsInitialized<'a, C, T>,
Get the global of an initialized context.
fn new_root<'a, 'b, T>(&'b mut self) -> JSRoot<'a, T>
[src]
Create a new root.
fn cx(&self) -> *mut JSContext
[src]
fn rt(&self) -> *mut JSRuntime
[src]
fn gc(&mut self) where
S: CanAlloc,
[src]
S: CanAlloc,
fn prototype_of<T>(&mut self) -> Handle<*mut JSObject> where
T: JSInitializable,
[src]
T: JSInitializable,
fn evaluate<C>(&mut self, code: &str) -> Result<Value, JSEvaluateErr> where
S: InCompartment<C>,
[src]
S: InCompartment<C>,