pub type DomRoot<T> = Root<Dom<T>>;Expand description
A rooted reference to a DOM object.
Aliased Type§
pub struct DomRoot<T> {
value: Dom<T>,
root_list: *const RootCollection,
}Fields§
§value: Dom<T>The value to root.
root_list: *const RootCollectionList that ensures correct dynamic root ordering
Implementations§
Source§impl<T: Castable> DomRoot<T>
impl<T: Castable> DomRoot<T>
Source§impl<T: DomObject> DomRoot<T>
impl<T: DomObject> DomRoot<T>
Sourcepub fn as_traced(&self) -> Dom<T>
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.
Sourcepub fn as_unrooted<'no_gc>(&self, no_gc: &'no_gc NoGC) -> UnrootedDom<'no_gc, T>
pub fn as_unrooted<'no_gc>(&self, no_gc: &'no_gc NoGC) -> UnrootedDom<'no_gc, T>
Return an unrooted version of this DOM object (UnrootedDom<T>) suitable for use on the
stack which has the lifetime of the provided NoGC token.
Trait Implementations§
Source§impl<T: DomObject + IDLInterface> FromJSValConvertible for DomRoot<T>
impl<T: DomObject + IDLInterface> FromJSValConvertible for DomRoot<T>
Source§fn from_jsval(
cx: &mut JSContext,
value: HandleValue<'_>,
_config: Self::Config,
) -> Result<ConversionResult<DomRoot<T>>, ()>
fn from_jsval( cx: &mut JSContext, value: HandleValue<'_>, _config: Self::Config, ) -> Result<ConversionResult<DomRoot<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> MallocSizeOf for DomRoot<T>where
T: DomObject + MallocSizeOf,
impl<T> MallocSizeOf for DomRoot<T>where
T: DomObject + MallocSizeOf,
Source§fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize
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> ToJSValConvertible for DomRoot<T>
impl<T: DomObject> ToJSValConvertible for DomRoot<T>
Source§fn to_jsval(&self, cx: &mut JSContext, rval: MutableHandleValue<'_>)
fn to_jsval(&self, cx: &mut JSContext, rval: MutableHandleValue<'_>)
Convert
self to a JSVal. JSAPI failure causes a panic.