Module burger::then

source ·
Expand description

The ServiceExt::then combinator returns Then, which extends a service with a closure modifying a Service::Response asynchronously.

For a synchronous version see the map module.

§Example

use burger::*;

let svc = service_fn(|x| async move { 7 * x }).then(|x| async move { x + 1 });
let response = svc.oneshot(2u32).await;
assert_eq!(response, 15);

§Load

The Load::load on Then defers to the inner service.

Structs§