Module burger::map

source ·
Expand description

The ServiceExt::map combinator returns Map, which extends a service with a specified closure from the modifying the Service::Response.

For an asynchronous version of this combinator see then module.

§Example

use burger::*;

let svc = service_fn(|x: u32| async move { x.to_string() }).map(|x: String| x.parse());
let response: usize = svc.oneshot(32).await.unwrap();
assert_eq!(response, 32);

§Load

Load measurements defer to the inner service.

Structs§