Module burger::service_fn

source ·
Expand description

The service_fn function accepts a closure accepting a request and returning a Future and returns ServiceFn, a Service which is immediately permitted to run the closure.

§Example

use burger::*;

let svc = service_fn(|x: u64| async move { x.to_string() });
let response = svc.oneshot(32).await;
assert_eq!(response, "32");

§Load

This has no Load implementation.

Structs§

Functions§