event

  • EventListener

A trait for event listeners that defines a method for handling events.

  • Events

A struct that manages event handlers and listeners.

  • new()

Creates a new Events instance.

  • register_listener<T: EventListener + 'static>(&mut self, event_name: &str, listener: T)

Registers a listener for the specified event.

  • create_event(&mut self, event_name: &str)

Creates a new custom event with no listeners initially.

  • trigger_event(&self, event_name: &str)

Triggers the specified event, executing all registered handlers. If the event has no handlers, a message is printed.

  • event!($name:expr)

A macro for defining event names as static strings.

Last updated