script::dom::worker

Type Alias TrustedWorkerAddress

Source
pub(crate) type TrustedWorkerAddress = Trusted<Worker>;

Aliased Type§

struct TrustedWorkerAddress {
    refcount: Arc<TrustedReference>,
    owner_thread: *const LiveDOMReferences,
    phantom: PhantomData<Worker>,
}

Fields§

§refcount: Arc<TrustedReference>

A pointer to the Rust DOM object of type T, but void to allow sending Trusted<T> between threads, regardless of T’s sendability.

§owner_thread: *const LiveDOMReferences§phantom: PhantomData<Worker>

Implementations

Source§

impl<T: DomObject> Trusted<T>

Source

pub(crate) fn new(ptr: &T) -> Trusted<T>

Create a new Trusted<T> instance from an existing DOM pointer. The DOM object will be prevented from being GCed for the duration of the resulting Trusted<T> object’s lifetime.

Source

pub(crate) fn root(&self) -> DomRoot<T>

Obtain a usable DOM pointer from a pinned Trusted<T> value. Fails if used on a different thread than the original value from which this Trusted<T> was obtained.

Trait Implementations

Source§

impl<T: DomObject> Clone for Trusted<T>

Source§

fn clone(&self) -> Trusted<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> MallocSizeOf for Trusted<T>

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
Source§

impl<T: DomObject> Traceable for Trusted<T>

Source§

unsafe fn trace(&self, _: *mut JSTracer)

Trace self.
Source§

impl<T: DomObject> Send for Trusted<T>