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: &mut Scope,
        this: <Self as CubeType>::ExpandType,
        event: <Self::Event as CubeType>::ExpandType,
        bus: <ComptimeEventBus as CubeType>::ExpandType,
    ) -> <() 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: &mut Scope, this: <Self as CubeType>::ExpandType, event: <Self::Event as CubeType>::ExpandType, bus: <ComptimeEventBus as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§