aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/event_dispatcher/event_subscriber_interface.rs
blob: 41d723dc5bc2c89d563976391c984a2298f14579 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! ref: composer/src/Composer/EventDispatcher/EventSubscriberInterface.php

use indexmap::IndexMap;

/// Represents one event's subscriber info: method name only, method+priority, or multiple handlers.
pub enum SubscribedEventEntry {
    Method(String),
    MethodWithPriority(String, Option<i64>),
    Methods(Vec<(String, Option<i64>)>),
}

pub trait EventSubscriberInterface {
    /// Returns an array of event names this subscriber wants to listen to.
    fn get_subscribed_events() -> IndexMap<String, SubscribedEventEntry>;
}