pub trait EventSubject: Sized + Send + Sync {
    type Config: Send + Sync;
    type Connection;
    type Error: Error + 'static;

    // Required methods
    fn connect(
        config: &Self::Config
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send;
    fn on_init<ML: MsgListener>(
        &mut self,
        msg_broker: &mut ML
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn on_notify<ML: MsgListener>(
        &mut self,
        msg_broker: &mut ML
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

Describes structures that can act as an Event Subject, such as an IRC Chat Monitor or any system that needs real-time monitoring and dynamic state alignment based on external conditions.

Required Associated Types§

source

type Config: Send + Sync

Configuration needed to connect to the event subject.

source

type Connection

Connection interface for the event subject.

source

type Error: Error + 'static

Any Error type returned by operations on the event subject.

Required Methods§

source

fn connect( config: &Self::Config ) -> impl Future<Output = Result<Self, Self::Error>> + Send

Establishes connection to the event subject using specific configuration. This should enable further operations without additional preparations.

source

fn on_init<ML: MsgListener>( &mut self, msg_broker: &mut ML ) -> impl Future<Output = Result<(), Self::Error>> + Send

Actions that will be performed on initialization of the program.

source

fn on_notify<ML: MsgListener>( &mut self, msg_broker: &mut ML ) -> impl Future<Output = Result<(), Self::Error>> + Send

Actions that will be performed whenever we receive a notification from the Message Listener.

Object Safety§

This trait is not object safe.

Implementors§