Skip to main content

Application

Trait Application 

Source
pub trait Application: Send + Sync {
    type Input: Send;
    type Output: Send;
    type Error: Send + Debug;

    // Required methods
    fn name(&self) -> &str;
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        input: Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An Application is a peer unit of (input → internal processing → output).

Required Associated Types§

Source

type Input: Send

The request type this Application accepts.

Source

type Output: Send

The result type returned on success.

Source

type Error: Send + Debug

The error type returned on failure.

Required Methods§

Source

fn name(&self) -> &str

A short identifier for this Application instance (used in logs and diagnostics).

Source

fn handle<'life0, 'async_trait>( &'life0 self, input: Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process one Input and produce an Output, or fail with Error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§