a3s_boot/routing/
handler.rs1use crate::{BootRequest, BootResponse, BoxFuture, Result};
2use std::future::Future;
3
4pub trait RouteHandler: Send + Sync + 'static {
6 fn call(&self, request: BootRequest) -> BoxFuture<'static, Result<BootResponse>>;
7}
8
9impl<F, Fut> RouteHandler for F
10where
11 F: Fn(BootRequest) -> Fut + Send + Sync + 'static,
12 Fut: Future<Output = Result<BootResponse>> + Send + 'static,
13{
14 fn call(&self, request: BootRequest) -> BoxFuture<'static, Result<BootResponse>> {
15 Box::pin(self(request))
16 }
17}