Skip to main content

EventRoute

Struct EventRoute 

Source
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

Source

pub fn new<T: ?Sized>(e: &RoutedEvent<T>) -> Self

Creates a route for a routed event.

Source

pub fn has_handlers(&self) -> bool

Whether the route has any handlers.

Source

pub fn add( &mut self, target: &Ref<Interactive>, handler: RouteHandler, routes: RoutingStrategies, handled_events_too: bool, )

Adds a handler to the route.

Source

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.

Source

pub fn raise_event(&self, source: &Ref<Interactive>, e: &dyn IRoutedEventArgs)

Raises an event along the route.

Source

pub fn dispose(&mut self)

Releases the route’s handler list back to the pool.

Trait Implementations§

Source§

impl Drop for EventRoute

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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> ClassDefaults for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.