Function wrap_fn

Source
pub fn wrap_fn<F>(f: F) -> WrapFn<F>
Expand description

使用函数构建一个Wrap

§例子

use puzz_service::{Service, ServiceExt};
use puzz_service::util::{service_fn, wrap_fn, BoxService};

let wrap = wrap_fn(|servcie: BoxService<(), (), ()>| {
    servcie.map_response(|_: ()| "Hello World")
});

let service = service_fn(|_: ()| async {
    Ok::<_, ()>(())
}).boxed();

let service = service.with(wrap);