Add prelude

This commit is contained in:
David Pedersen 2021-06-06 11:42:44 +02:00
parent 46398afc72
commit 470d6ceabd
2 changed files with 11 additions and 1 deletions

View file

@ -2,7 +2,7 @@ use http::{Request, StatusCode};
use hyper::Server;
use std::net::SocketAddr;
use tower::make::Shared;
use tower_web::{body::Body, extract, get, response, route, AddRoute};
use tower_web::prelude::*;
#[tokio::main]
async fn main() {

View file

@ -68,6 +68,16 @@ pub use self::{
pub use async_trait::async_trait;
pub use tower_http::add_extension::{AddExtension, AddExtensionLayer};
pub mod prelude {
pub use crate::{
body::Body,
extract,
handler::{get, on, post, Handler},
response, route,
routing::AddRoute,
};
}
pub fn route<S>(spec: &str, svc: S) -> Route<S, EmptyRouter>
where
S: Service<Request<Body>, Error = Infallible> + Clone,