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>
impl<D: Dom, DomElement: JsCast + Clone> ElementHandle<D, DomElement>
sourcepub fn try_dom_element(&self) -> Option<DomElement>
pub fn try_dom_element(&self) -> Option<DomElement>
sourcepub fn dom_element(&self) -> DomElement
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>
impl<D: Dom> ElementHandle<D, Element>
sourcepub fn cast<T: JsCast>(self) -> ElementHandle<D, T>
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,
impl<D: Clone + Dom, DomElement: Clone> Clone for ElementHandle<D, DomElement>where
D::Element: Clone,
source§fn clone(&self) -> ElementHandle<D, DomElement>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto 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>
impl<D, DomElement> Sync for ElementHandle<D, DomElement>
impl<D, DomElement> Unpin for ElementHandle<D, DomElement>
impl<D, DomElement> UnwindSafe for ElementHandle<D, DomElement>where
<D as Dom>::Element: UnwindSafe,
DomElement: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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