Skip to main content

Responder

Trait Responder 

Source
pub trait Responder {
    // Required method
    fn respond<C: Command + 'static>(
        self,
    ) -> impl Future<Output = Result<impl Stream<Item = Result<impl ReceivedCommand<C> + Send + Sync + 'static, Error>> + Send + 'static, Error>> + Send + 'static;
}
Expand description

Subscribes to incoming commands. Mirrors Subscriber.

respond takes self by value so the returned future is 'static with no borrow of the implementor. Callers that need to keep a handle should clone before calling (e.g. conn.clone().respond::<C>()).

Required Methods§

Source

fn respond<C: Command + 'static>( self, ) -> impl Future<Output = Result<impl Stream<Item = Result<impl ReceivedCommand<C> + Send + Sync + 'static, Error>> + Send + 'static, Error>> + Send + 'static

Subscribe to commands of type C and return a stream of received commands.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Responder + Clone + Send + Sync + 'static> Responder for Arc<T>

Source§

fn respond<C: Command + 'static>( self, ) -> impl Future<Output = Result<impl Stream<Item = Result<impl ReceivedCommand<C> + Send + Sync + 'static, Error>> + Send + 'static, Error>> + Send + 'static

Implementors§