EventManagement

Trait EventManagement 

Source
pub trait EventManagement {
    // Required methods
    fn send_event(
        &mut self,
        command_data: CommandData,
    ) -> impl Future<Output = Result<ResultData, SessionSendError>>;
    fn get_bidi_events(&mut self) -> &mut Arc<StdMutex<Vec<BidiEvent>>>;
    fn push_event(&mut self, event: BidiEvent);

    // Provided methods
    fn subscribe_events<F, R>(
        &mut self,
        events: HashSet<&str>,
        handler: F,
        browsing_contexts: Option<Vec<String>>,
        _user_contexts: Option<Vec<&str>>,
    ) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>>
       where F: FnMut(Event) -> R + Send + Sync + 'static,
             R: Future<Output = ()> + Send + 'static { ... }
    fn add_event_handler<F, R>(
        &mut self,
        events: HashSet<&str>,
        handler: F,
        handler_id: Option<String>,
    ) -> String
       where F: FnMut(Event) -> R + Send + Sync + 'static,
             R: Future<Output = ()> + Send + 'static { ... }
    fn unsubscribe_events_by_names(
        &mut self,
        events: HashSet<&str>,
    ) -> impl Future<Output = Result<Option<UnsubscribeResult>, CommandResultError>> { ... }
    fn unsubscribe_events_by_ids(
        &mut self,
        subscription_ids: Vec<Subscription>,
    ) -> impl Future<Output = Result<Option<UnsubscribeResult>, CommandResultError>> { ... }
    fn event_dispatch(
        &mut self,
    ) -> impl Future<Output = (JoinHandle<()>, UnboundedSender<Event>)> { ... }
}

Required Methods§

Source

fn send_event( &mut self, command_data: CommandData, ) -> impl Future<Output = Result<ResultData, SessionSendError>>

Source

fn get_bidi_events(&mut self) -> &mut Arc<StdMutex<Vec<BidiEvent>>>

Source

fn push_event(&mut self, event: BidiEvent)

Provided Methods§

Source

fn subscribe_events<F, R>( &mut self, events: HashSet<&str>, handler: F, browsing_contexts: Option<Vec<String>>, _user_contexts: Option<Vec<&str>>, ) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>>
where F: FnMut(Event) -> R + Send + Sync + 'static, R: Future<Output = ()> + Send + 'static,

Source

fn add_event_handler<F, R>( &mut self, events: HashSet<&str>, handler: F, handler_id: Option<String>, ) -> String
where F: FnMut(Event) -> R + Send + Sync + 'static, R: Future<Output = ()> + Send + 'static,

Add an event handler without sending a subscription command Returns the handler ID (either provided or generated)

Source

fn unsubscribe_events_by_names( &mut self, events: HashSet<&str>, ) -> impl Future<Output = Result<Option<UnsubscribeResult>, CommandResultError>>

Unsubscribe from events by event names

Source

fn unsubscribe_events_by_ids( &mut self, subscription_ids: Vec<Subscription>, ) -> impl Future<Output = Result<Option<UnsubscribeResult>, CommandResultError>>

Unsubscribe from events by subscription IDs

Source

fn event_dispatch( &mut self, ) -> impl Future<Output = (JoinHandle<()>, UnboundedSender<Event>)>

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§