Trait mockable::HttpServer

source ·
pub trait HttpServer: Send + Sync {
    // Required methods
    fn next<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Option<HttpRequest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Simple HTTP server that listen all requests.

This is supported on feature=http only.

Example.

Required Methods§

source

fn next<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Option<HttpRequest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the next request received by the server.

None is returned if the server is stopped.

source

fn stop<'async_trait>( self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,

Stops the server.

Implementors§