Struct silkenweb::node::element::ElementHandle

source ·
pub struct ElementHandle<D: Dom, DomElement>(/* private fields */);
Expand description

A handle to an element in the DOM.

The handle will only be valid for Wet DOM elements, so the methods should only be used inside event handlers and effects.

See Element::handle for an example.

Implementations§

source§

impl<D: Dom, DomElement: JsCast + Clone> ElementHandle<D, DomElement>

source

pub fn try_dom_element(&self) -> Option<DomElement>

Get the associated DOM element, if it is a Wet element.

If the referenced element is not Wet or a hydrated Hydro element, this will return None.

source

pub fn dom_element(&self) -> DomElement

Get the associated DOM element, or panic.

§Panics

This will panic if Self::try_dom_element would return None, or self was created from an invalid ElementHandle::cast.

source§

impl<D: Dom> ElementHandle<D, Element>

source

pub fn cast<T: JsCast>(self) -> ElementHandle<D, T>

Cast the dom type of an ElementHandle.

It is the clients responsibility to ensure the new type is correct.

Trait Implementations§

source§

impl<D: Clone + Dom, DomElement: Clone> Clone for ElementHandle<D, DomElement>
where D::Element: Clone,

source§

fn clone(&self) -> ElementHandle<D, DomElement>

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

Auto Trait Implementations§

§

impl<D, DomElement> Freeze for ElementHandle<D, DomElement>
where <D as Dom>::Element: Freeze,

§

impl<D, DomElement> RefUnwindSafe for ElementHandle<D, DomElement>
where <D as Dom>::Element: RefUnwindSafe, DomElement: RefUnwindSafe,

§

impl<D, DomElement> Send for ElementHandle<D, DomElement>
where <D as Dom>::Element: Send, DomElement: Send,

§

impl<D, DomElement> Sync for ElementHandle<D, DomElement>
where <D as Dom>::Element: Sync, DomElement: Sync,

§

impl<D, DomElement> Unpin for ElementHandle<D, DomElement>
where <D as Dom>::Element: Unpin, DomElement: Unpin,

§

impl<D, DomElement> UnwindSafe for ElementHandle<D, DomElement>
where <D as Dom>::Element: UnwindSafe, DomElement: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

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> ToOwned for T
where 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 T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.