From a7ae4c2c26fc75ad604e49ddf5a69f65ff21db81 Mon Sep 17 00:00:00 2001 From: Erik Hollensbe Date: Sat, 22 Jan 2022 14:06:30 -0800 Subject: [PATCH] use ratpack::prelude::* in examples and readme Signed-off-by: Erik Hollensbe --- README.md | 4 +--- examples/auth-with-state.rs | 2 -- examples/disk-auth.rs | 4 +--- examples/hello-world.rs | 4 +--- examples/log.rs | 4 +--- 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2f51dbc..1db5eb4 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,7 @@ Here is an example which carries global _application state_ as an authentication **Note:** this is available at [examples/auth-with-state.rs](examples/auth-with-state.rs). It can also be run with cargo: `cargo run --example auth-with-state`. ```rust -use http::{Request, Response, StatusCode}; -use hyper::Body; -use ratpack::{app::App, compose_handler, handler::Params, Error, HTTPResult, ServerError}; +use ratpack::prelude::*; // our authtoken validator, this queries the app state and the header // `X-AuthToken` and compares the two. If there are any discrepancies, it diff --git a/examples/auth-with-state.rs b/examples/auth-with-state.rs index 27a5ec3..73f8340 100644 --- a/examples/auth-with-state.rs +++ b/examples/auth-with-state.rs @@ -1,5 +1,3 @@ -use http::{Request, Response, StatusCode}; -use hyper::Body; use ratpack::prelude::*; async fn validate_authtoken( diff --git a/examples/disk-auth.rs b/examples/disk-auth.rs index 9fcc874..17794c0 100644 --- a/examples/disk-auth.rs +++ b/examples/disk-auth.rs @@ -1,6 +1,4 @@ -use http::{Request, Response, StatusCode}; -use hyper::Body; -use ratpack::{app::App, compose_handler, Error, HTTPResult, Params, ServerError}; +use ratpack::prelude::*; const DEFAULT_AUTHTOKEN: &str = "867-5309"; const AUTHTOKEN_FILENAME: &str = "authtoken.secret"; diff --git a/examples/hello-world.rs b/examples/hello-world.rs index 8253208..7bc7f59 100644 --- a/examples/hello-world.rs +++ b/examples/hello-world.rs @@ -1,6 +1,4 @@ -use http::{Request, Response}; -use hyper::Body; -use ratpack::{app::App, compose_handler, HTTPResult, Params, ServerError}; +use ratpack::prelude::*; async fn hello( req: Request, diff --git a/examples/log.rs b/examples/log.rs index 83cb42b..b8d9256 100644 --- a/examples/log.rs +++ b/examples/log.rs @@ -1,7 +1,5 @@ -use http::{Request, Response}; -use hyper::Body; use log::LevelFilter; -use ratpack::{app::App, compose_handler, HTTPResult, Params, ServerError}; +use ratpack::prelude::*; async fn log( req: Request,