Struct dioxus_core::prelude::Event
source · pub struct Event<T: 'static + ?Sized> {
pub data: Rc<T>,
/* private fields */
}Expand description
A wrapper around some generic data that handles the event’s state
Prevent this event from continuing to bubble up the tree to parent elements.
§Example
rsx! {
button {
onclick: move |evt: Event<MouseData>| {
evt.stop_propagation();
}
}
};Fields§
§data: Rc<T>The data associated with this event
Implementations§
source§impl<T> Event<T>
impl<T> Event<T>
sourcepub fn map<U: 'static, F: FnOnce(&T) -> U>(&self, f: F) -> Event<U>
pub fn map<U: 'static, F: FnOnce(&T) -> U>(&self, f: F) -> Event<U>
Map the event data to a new type
§Example
rsx! {
button {
onclick: move |evt: MouseEvent| {
let data = evt.map(|data| data.client_coordinates());
println!("{:?}", data.data());
}
}
};sourcepub fn cancel_bubble(&self)
👎Deprecated: use stop_propagation instead
pub fn cancel_bubble(&self)
Prevent this event from continuing to bubble up the tree to parent elements.
§Example
rsx! {
button {
onclick: move |evt: Event<MouseData>| {
evt.cancel_bubble();
}
}
};sourcepub fn stop_propagation(&self)
pub fn stop_propagation(&self)
Prevent this event from continuing to bubble up the tree to parent elements.
§Example
rsx! {
button {
onclick: move |evt: Event<MouseData>| {
evt.stop_propagation();
}
}
};Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Event<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for Event<T>
impl<T> !Send for Event<T>
impl<T> !Sync for Event<T>
impl<T> Unpin for Event<T>where
T: ?Sized,
impl<T> !UnwindSafe for Event<T>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.