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§
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>>
Sourcefn add_event_handler<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
handler_id: Option<String>,
) -> String
fn add_event_handler<F, R>( &mut self, events: HashSet<&str>, handler: F, handler_id: Option<String>, ) -> String
Add an event handler without sending a subscription command Returns the handler ID (either provided or generated)
Sourcefn unsubscribe_events_by_names(
&mut self,
events: HashSet<&str>,
) -> impl Future<Output = Result<Option<UnsubscribeResult>, CommandResultError>>
fn unsubscribe_events_by_names( &mut self, events: HashSet<&str>, ) -> impl Future<Output = Result<Option<UnsubscribeResult>, CommandResultError>>
Unsubscribe from events by event names
Sourcefn unsubscribe_events_by_ids(
&mut self,
subscription_ids: Vec<Subscription>,
) -> 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>>
Unsubscribe from events by subscription IDs
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.