Struct josephine::managed::JSManaged
[−]
[src]
pub struct JSManaged<'a, C, T> { /* fields omitted */ }
The type of JS-managed data in a JS compartment C
, with lifetime 'a
and type T
.
If the user has access to a JSManaged
, then the JS-managed
data is live for the given lifetime.
Methods
impl<'a, C, T> JSManaged<'a, C, T>
[src]
fn new<S>(cx: &'a mut JSContext<S>, 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>,
unsafe fn from_raw(
js_object: *mut Heap<*mut JSObject>,
raw: *mut ()
) -> JSManaged<'a, C, T>
[src]
js_object: *mut Heap<*mut JSObject>,
raw: *mut ()
) -> JSManaged<'a, C, T>
fn get<'b, S>(self, _: &'b JSContext<S>) -> T::Aged where
S: CanAccess,
C: Compartment,
T: JSLifetime<'b>,
T::Aged: Copy,
'a: 'b,
[src]
S: CanAccess,
C: Compartment,
T: JSLifetime<'b>,
T::Aged: Copy,
'a: 'b,
Read-only access to JS-managed data.
fn borrow<'b, S>(self, _: &'b JSContext<S>) -> &'b T::Aged where
S: CanAccess,
C: Compartment,
T: JSLifetime<'b>,
'a: 'b,
[src]
S: CanAccess,
C: Compartment,
T: JSLifetime<'b>,
'a: 'b,
fn borrow_mut<'b, S>(self, _: &'b mut JSContext<S>) -> &'b mut T::Aged where
S: CanAccess,
C: Compartment,
T: JSLifetime<'b>,
'a: 'b,
[src]
S: CanAccess,
C: Compartment,
T: JSLifetime<'b>,
'a: 'b,
Read-write access to JS-managed data.
unsafe fn change_compartment<D>(self) -> JSManaged<'a, D, T::ChangeCompartment> where
T: JSCompartmental<C, D>,
[src]
T: JSCompartmental<C, D>,
Change the compartment of JS-managed data.
unsafe fn change_lifetime<'b>(self) -> JSManaged<'b, C, T::Aged> where
T: JSLifetime<'b>,
[src]
T: JSLifetime<'b>,
Change the lifetime of JS-managed data.
fn extend_lifetime<'b, 'c, S>(
self,
_: &'c JSContext<S>
) -> JSManaged<'b, C, T::Aged> where
S: IsSnapshot<'b>,
T: JSLifetime<'b>,
[src]
self,
_: &'c JSContext<S>
) -> JSManaged<'b, C, T::Aged> where
S: IsSnapshot<'b>,
T: JSLifetime<'b>,
It's safe to extend the lifetime of JS-managed data if it has been snapshotted.
fn forget_compartment(self) -> JSManaged<'a, SOMEWHERE, T::ChangeCompartment> where
T: JSCompartmental<C, SOMEWHERE>,
[src]
T: JSCompartmental<C, SOMEWHERE>,
Forget about which compartment the managed data is in.
This is safe because when we mutate data in compartment C
we require
C: Compartment
, which means it is never SOMEWHERE
.
fn in_compartment<S, D>(
self,
cx: &JSContext<S>
) -> Option<JSManaged<'a, D, T::ChangeCompartment>> where
T: JSCompartmental<C, D>,
S: InCompartment<D>,
[src]
self,
cx: &JSContext<S>
) -> Option<JSManaged<'a, D, T::ChangeCompartment>> where
T: JSCompartmental<C, D>,
S: InCompartment<D>,
Check to see if the current object is in the same compartment as another.
fn to_raw_native(self) -> *mut Option<T>
[src]
fn to_heap_object(self) -> *mut Heap<*mut JSObject>
[src]
fn to_jsobject(self) -> *mut JSObject
[src]
fn to_jsval(self) -> Value
[src]
Trait Implementations
impl<'a, C, D, T> JSCompartmental<C, D> for JSManaged<'a, C, T> where
T: JSCompartmental<C, D>,
[src]
T: JSCompartmental<C, D>,
type ChangeCompartment = JSManaged<'a, D, T::ChangeCompartment>
fn is_in_compartment<S>(&self, cx: &JSContext<S>) -> bool where
S: InCompartment<D>,
[src]
S: InCompartment<D>,
impl<'a, C, T> Clone for JSManaged<'a, C, T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a, C, T> Copy for JSManaged<'a, C, T>
[src]
impl<'a, C, T> Debug for JSManaged<'a, C, T>
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl<'a, C, T> PartialEq for JSManaged<'a, C, T>
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, C, T> Eq for JSManaged<'a, C, T>
[src]
impl<'a, C, T> JSTraceable for JSManaged<'a, C, T> where
T: JSTraceable,
[src]
T: JSTraceable,
unsafe fn trace(&self, trc: *mut JSTracer)
[src]
fn as_ptr(&self) -> *const JSTraceable where
Self: Sized,
[src]
Self: Sized,
fn as_mut_ptr(&mut self) -> *mut JSTraceable where
Self: Sized,
[src]
Self: Sized,
impl<'a, 'b, C, T> JSLifetime<'a> for JSManaged<'b, C, T> where
T: JSLifetime<'a>,
[src]
T: JSLifetime<'a>,
type Aged = JSManaged<'a, C, T::Aged>
unsafe fn change_lifetime(self) -> Self::Aged where
Self: Sized,
[src]
Self: Sized,
fn contract_lifetime(self) -> Self::Aged where
Self: 'a + Sized,
[src]
Self: 'a + Sized,
fn in_root(self, root: &'a mut JSRoot<'a, Self::Aged>) -> Self::Aged where
Self: Sized,
Self::Aged: Copy + JSTraceable,
[src]
Self: Sized,
Self::Aged: Copy + JSTraceable,