pub struct Listener<Element: Deref<Target = EventTarget>, Arg: FromWasmAbi + 'static = JsValue> { /* private fields */ }Expand description
Safe wrapper around eventListener callbacks that cleans them up once the Listener struct is dropped
For more information, see https://github.com/rustwasm/wasm-bindgen/issues/993.
This utility can be used with any type that dereferences to EventTarget, so it is not limited to just pure HtmlElements.
Implementations§
Source§impl<Element: Deref<Target = EventTarget>, Arg: FromWasmAbi + 'static> Listener<Element, Arg>
impl<Element: Deref<Target = EventTarget>, Arg: FromWasmAbi + 'static> Listener<Element, Arg>
Trait Implementations§
Source§impl<Element: Debug + Deref<Target = EventTarget>, Arg: Debug + FromWasmAbi + 'static> Debug for Listener<Element, Arg>
impl<Element: Debug + Deref<Target = EventTarget>, Arg: Debug + FromWasmAbi + 'static> Debug for Listener<Element, Arg>
Auto Trait Implementations§
impl<Element, Arg> Freeze for Listener<Element, Arg>where
Element: Freeze,
impl<Element, Arg = JsValue> !RefUnwindSafe for Listener<Element, Arg>
impl<Element, Arg = JsValue> !Send for Listener<Element, Arg>
impl<Element, Arg = JsValue> !Sync for Listener<Element, Arg>
impl<Element, Arg> Unpin for Listener<Element, Arg>where
Element: Unpin,
impl<Element, Arg = JsValue> !UnwindSafe for Listener<Element, Arg>
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