Skip to main content

EventListener

Trait EventListener 

Source
pub trait EventListener: 'static + CubeType<ExpandType: EventListenerExpand<Event = Self::Event>> {
    type Event: CubeType + 'static;

    // Required method
    fn on_event(&mut self, event: Self::Event, bus: &mut ComptimeEventBus);

    // Provided method
    fn __expand_on_event(
        scope: &Scope,
        this: &mut <Self as CubeType>::ExpandType,
        event: <Self::Event as CubeType>::ExpandType,
        bus: &mut <ComptimeEventBus as CubeType>::ExpandType,
    ) { ... }
}
Expand description

Defines a listener that is called each time an event is triggered on an event bus.

Required Associated Types§

Source

type Event: CubeType + 'static

The event type triggering the EventListener::on_event callback.

Required Methods§

Source

fn on_event(&mut self, event: Self::Event, bus: &mut ComptimeEventBus)

The function called when an event of the type EventListener::Event is registered on the ComptimeEventBus.

Provided Methods§

Source

fn __expand_on_event( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, event: <Self::Event as CubeType>::ExpandType, bus: &mut <ComptimeEventBus as CubeType>::ExpandType, )

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§