Skip to main content

Responder

Trait Responder 

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

Re-exported so services only need to depend on arminius-lib-nats.

The message-bus Subscriber trait is intentionally not re-exported here to avoid clashing with the async_nats::Subscriber re-export above; reach it via arminius_lib_message_bus::Subscriber. 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>( self, ) -> impl Future<Output = Result<impl Stream<Item = Result<impl ReceivedCommand<C> + Send + Sync + 'static, Error>> + Send + 'static, Error>> + Send + 'static
where C: Command + '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 for Arc<T>
where T: Responder + Clone + Send + Sync + 'static,

Source§

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

Implementors§