pub trait BidiEventManagement {
// Required methods
fn send_event(
&mut self,
command: impl Into<Command>,
) -> impl Future<Output = Result<CommandResponse, SessionSendError>>;
fn get_events(&mut self) -> &mut Arc<StdMutex<Vec<BidiEvent>>>;
fn push_event(&mut self, event: BidiEvent);
// Provided methods
fn create_event<F, R, T: BidiEventManagement>(
&mut self,
events: HashSet<&str>,
handler: F,
) -> BidiEvent
where F: FnMut(Event) -> R + Send + Sync + 'static,
R: Future<Output = ()> + Send + 'static { ... }
fn subscribe_events(
&mut self,
bidi_event: BidiEvent,
) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>> { ... }
fn add_event_handler<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
) -> 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<UnsubscribeResult, CommandResultError>> { ... }
fn event_dispatch(
&mut self,
) -> impl Future<Output = (JoinHandle<()>, UnboundedSender<EventResponse>)> { ... }
}Required Methods§
fn send_event( &mut self, command: impl Into<Command>, ) -> impl Future<Output = Result<CommandResponse, SessionSendError>>
fn get_events(&mut self) -> &mut Arc<StdMutex<Vec<BidiEvent>>>
fn push_event(&mut self, event: BidiEvent)
Provided Methods§
fn create_event<F, R, T: BidiEventManagement>( &mut self, events: HashSet<&str>, handler: F, ) -> BidiEvent
fn subscribe_events( &mut self, bidi_event: BidiEvent, ) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>>
Sourcefn add_event_handler<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
) -> String
fn add_event_handler<F, R>( &mut self, events: HashSet<&str>, handler: F, ) -> 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<UnsubscribeResult, CommandResultError>>
fn unsubscribe_events_by_ids( &mut self, subscription_ids: Vec<Subscription>, ) -> impl Future<Output = Result<UnsubscribeResult, CommandResultError>>
Unsubscribe from events by subscription IDs
fn event_dispatch( &mut self, ) -> impl Future<Output = (JoinHandle<()>, UnboundedSender<EventResponse>)>
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.