Skip to main content

BidiEventManagement

Trait BidiEventManagement 

Source
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§

Source

fn send_event( &mut self, command: impl Into<Command>, ) -> impl Future<Output = Result<CommandResponse, SessionSendError>>

Source

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

Source

fn push_event(&mut self, event: BidiEvent)

Provided Methods§

Source

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,

Source

fn subscribe_events( &mut self, bidi_event: BidiEvent, ) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>>

Source

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,

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<UnsubscribeResult, CommandResultError>>

Unsubscribe from events by subscription IDs

Source

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.

Implementors§