pub struct EventRoute { /* private fields */ }Expand description
Holds the route for a routed event and supports raising an event on that route.
The list of handlers is taken from a per-thread pool and returned to it when the route is dropped (or disposed), so raising an event does not allocate once the pool is warm.
Implementations§
Source§impl EventRoute
impl EventRoute
Sourcepub fn new<T: ?Sized>(e: &RoutedEvent<T>) -> Self
pub fn new<T: ?Sized>(e: &RoutedEvent<T>) -> Self
Creates a route for a routed event.
Sourcepub fn has_handlers(&self) -> bool
pub fn has_handlers(&self) -> bool
Whether the route has any handlers.
Sourcepub fn add(
&mut self,
target: &Ref<Interactive>,
handler: RouteHandler,
routes: RoutingStrategies,
handled_events_too: bool,
)
pub fn add( &mut self, target: &Ref<Interactive>, handler: RouteHandler, routes: RoutingStrategies, handled_events_too: bool, )
Adds a handler to the route.
Sourcepub fn add_class_handler(&mut self, target: &Ref<Interactive>)
pub fn add_class_handler(&mut self, target: &Ref<Interactive>)
Adds a class handler to the route: a marker that makes the class
handlers of the event run for target.
Sourcepub fn raise_event(&self, source: &Ref<Interactive>, e: &dyn IRoutedEventArgs)
pub fn raise_event(&self, source: &Ref<Interactive>, e: &dyn IRoutedEventArgs)
Raises an event along the route.
Trait Implementations§
Source§impl Drop for EventRoute
impl Drop for EventRoute
Auto Trait Implementations§
impl !RefUnwindSafe for EventRoute
impl !Send for EventRoute
impl !Sync for EventRoute
impl !UnwindSafe for EventRoute
impl Freeze for EventRoute
impl Unpin for EventRoute
impl UnsafeUnpin for EventRoute
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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more