micro_tower/
util.rs

1pub mod borrow;
2
3use std::future::Future;
4use std::pin::Pin;
5
6pub use tower::BoxError;
7use tower::Service;
8
9pub type BoxService<R, S> = Box<
10    dyn Service<
11            R,
12            Response = <S as Service<R>>::Response,
13            Future = BoxFuture<Result<<S as Service<R>>::Response, BoxError>>,
14            Error = BoxError,
15        > + Send,
16>;
17
18pub type BoxCloneService<R, S> =
19    tower::util::BoxCloneService<R, <S as Service<R>>::Response, BoxError>;
20
21pub type BoxFuture<O> = Pin<Box<dyn Future<Output = O> + Send>>;
22
23/// Generates a [`std::error::Report`] with `pretty` and `backtrace` enabled
24#[macro_export]
25macro_rules! report {
26    ($err:expr) => {
27        ::std::error::Report::new($err)
28            .pretty(true)
29            .show_backtrace(true)
30    };
31}