Struct script::dom::bindings::root::Root

source ·
pub struct Root<T: StableTraceObject> {
    value: T,
    root_list: *const RootCollection,
}
Expand description

A rooted value.

Fields§

§value: T

The value to root.

§root_list: *const RootCollection

List that ensures correct dynamic root ordering

Implementations§

source§

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

source

pub unsafe fn new(value: T) -> Self

Create a new stack-bounded root for the provided value. It cannot outlive its associated RootCollection, and it gives out references which cannot outlive this new Root.

source§

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

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: DomObject> Root<Dom<T>>

source

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

Generate a new root from a reference

source§

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

source

pub fn as_ptr(&self) -> *const T

source§

impl<T> Root<MaybeUnreflectedDom<T>>where
    T: MutDomObject,

source

pub unsafe fn reflect_with(self, obj: *mut JSObject) -> Root<Dom<T>>

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 Debug for Root<Dom<Element>>

source§

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

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

impl<T> Deref for Root<T>where
    T: Deref + StableTraceObject,

§

type Target = <T as Deref>::Target

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> Drop for Root<T>where
    T: StableTraceObject,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a> Element for Root<Dom<Element>>

§

type Impl = SelectorImpl

source§

fn opaque(&self) -> OpaqueElement

Converts self into an opaque representation.
source§

fn parent_element(&self) -> Option<Root<Dom<Element>>>

source§

fn parent_node_is_shadow_root(&self) -> bool

Whether the parent node of this element is a shadow root.
source§

fn containing_shadow_host(&self) -> Option<Self>

The host of the containing shadow root, if any.
source§

fn is_pseudo_element(&self) -> bool

Whether we’re matching on a pseudo-element.
source§

fn match_pseudo_element(
    &self,
    _pseudo: &PseudoElement,
    _context: &mut MatchingContext<'_, Self::Impl>
) -> bool

source§

fn prev_sibling_element(&self) -> Option<Root<Dom<Element>>>

Skips non-element nodes
source§

fn next_sibling_element(&self) -> Option<Root<Dom<Element>>>

Skips non-element nodes
source§

fn attr_matches(
    &self,
    ns: &NamespaceConstraint<&Namespace>,
    local_name: &LocalName,
    operation: &AttrSelectorOperation<&AtomString>
) -> bool

source§

fn is_root(&self) -> bool

Returns whether this element matches :root, i.e. whether it is the root element of a document. Read more
source§

fn is_empty(&self) -> bool

Returns whether this element matches :empty. Read more
source§

fn has_local_name(&self, local_name: &LocalName) -> bool

source§

fn has_namespace(&self, ns: &Namespace) -> bool

Empty string for no namespace
source§

fn is_same_type(&self, other: &Self) -> bool

Whether this element and the other element have the same local name and namespace.
source§

fn match_non_ts_pseudo_class<F>(
    &self,
    pseudo_class: &NonTSPseudoClass,
    _: &mut MatchingContext<'_, Self::Impl>,
    _: &mut F
) -> boolwhere
    F: FnMut(&Self, ElementSelectorFlags),

Whether this element is a link.
source§

fn has_id(&self, id: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool

source§

fn is_part(&self, _name: &AtomIdent) -> bool

source§

fn imported_part(&self, _: &AtomIdent) -> Option<AtomIdent>

Returns the mapping from the exportparts attribute in the reverse direction, that is, in an outer-tree -> inner-tree direction.
source§

fn has_class(&self, name: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool

source§

fn is_html_element_in_html_document(&self) -> bool

source§

fn is_html_slot_element(&self) -> bool

Returns whether the element is an HTML element.
source§

fn pseudo_element_originating_element(&self) -> Option<Self>

The parent of a given pseudo-element, after matching a pseudo-element selector. Read more
source§

fn assigned_slot(&self) -> Option<Self>

Returns the assigned element this element is assigned to. Read more
source§

fn ignores_nth_child_selectors(&self) -> bool

Returns whether this element should ignore matching nth child selector.
source§

impl<T: DomObject + IDLInterface> FromJSValConvertible for Root<Dom<T>>

§

type Config = ()

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

unsafe fn from_jsval(
    cx: *mut JSContext,
    value: HandleValue<'_>,
    _config: Self::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 Hash for Root<Dom<GPUBuffer>>

source§

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

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

source§

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

Trace self.
source§

impl<T> MallocSizeOf for Root<Dom<T>>where
    T: DomObject + MallocSizeOf,

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

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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

source§

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

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

impl Eq for Root<Dom<GPUBuffer>>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Root<T>

§

impl<T> !Send for Root<T>

§

impl<T> !Sync for Root<T>

§

impl<T> Unpin for Root<T>where
    T: Unpin,

§

impl<T> !UnwindSafe for Root<T>

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Qwhere
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> MaybeBoxed<Box<T, Global>> for T

source§

fn maybe_boxed(self) -> Box<T, Global>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere
    V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
    S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Erased for T

source§

impl<T> Formattable for Twhere
    T: Deref,
    <T as Deref>::Target: Formattable,

source§

impl<T> Parsable for Twhere
    T: Deref,
    <T as Deref>::Target: Parsable,