script::dom::bindings::import::base

Type Alias DomRoot

Source
pub(crate) type DomRoot<T> = Root<Dom<T>>;
Expand description

A rooted reference to a DOM object.

Aliased Type§

struct DomRoot<T> { /* private fields */ }

Implementations

Source§

impl<T> Root<Dom<T>>
where T: Castable,

Source

pub fn upcast<U>(root: Root<Dom<T>>) -> Root<Dom<U>>
where U: Castable, T: DerivedFrom<U>,

Cast a DOM object root upwards to one of the interfaces it derives from.

Source

pub fn downcast<U>(root: Root<Dom<T>>) -> Option<Root<Dom<U>>>
where U: DerivedFrom<T>,

Cast a DOM object root downwards to one of the interfaces it might implement.

Source§

impl<T> Root<Dom<T>>
where T: DomObject,

Source

pub fn from_ref(unrooted: &T) -> Root<Dom<T>>

Generate a new root from a reference

Source

pub fn as_traced(&self) -> Dom<T>

Create a traced version of this rooted object.

§Safety

This should never be used to create on-stack values. Instead these values should always end up as members of other DOM objects.

Source§

impl<T> Root<T>
where T: StableTraceObject + 'static,

Source

pub unsafe fn new(value: T) -> Root<T>

Create a new stack-bounded root for the provided value. It gives out references which cannot outlive this new Root.

§Safety

It must not outlive its associated RootCollection.

Trait Implementations

Source§

impl<T> Clone for Root<Dom<T>>
where T: DomObject,

Source§

fn clone(&self) -> Root<Dom<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> Debug for Root<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for Root<T>

Source§

type Target = <T as Deref>::Target

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Root<T> as Deref>::Target

Dereferences the value.
Source§

impl<T> Drop for Root<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> FromJSValConvertible for Root<Dom<T>>

Source§

type Config = ()

Optional configurable behaviour switch; use () for no configuration.
Source§

unsafe fn from_jsval( cx: *mut JSContext, value: Handle<'_, Value>, _config: <Root<Dom<T>> as FromJSValConvertible>::Config, ) -> Result<ConversionResult<Root<Dom<T>>>, ()>

Convert val to type Self. Optional configuration of type T can be passed as the option argument. If it returns Err(()), a JSAPI exception is pending. If it returns Ok(Failure(reason)), there is no pending JSAPI exception.
Source§

impl<T> Hash for Root<Dom<T>>
where T: DomObject,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> MallocSizeOf for Root<Dom<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> PartialEq for Root<Dom<T>>
where T: DomObject,

Source§

fn eq(&self, other: &Root<Dom<T>>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> ToJSValConvertible for Root<Dom<T>>
where T: DomObject,

Source§

unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandle<'_, Value>)

Convert self to a JSVal. JSAPI failure causes a panic.
Source§

impl<T> Traceable for Root<Dom<T>>
where T: DomObject,

Source§

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

Trace self.
Source§

impl<T> Eq for Root<Dom<T>>
where T: DomObject,