1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#![forbid(unsafe_code)]
#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub)]
use viz_utils::anyhow;
mod context;
mod extract;
mod guard;
mod handler;
mod macros;
mod middleware;
mod response;
pub mod config;
pub mod types;
#[cfg(feature = "fs")]
pub mod fs;
#[cfg(feature = "sse")]
pub mod sse;
#[cfg(feature = "ws")]
pub mod ws;
#[allow(missing_docs)]
pub mod http {
pub use headers;
pub use http::*;
pub use hyper::Body;
pub use hyper::Error;
pub type Request<T = Body> = ::http::Request<T>;
pub type Response<T = Body> = ::http::Response<T>;
}
pub use handle::Handle as Middleware;
pub use anyhow::Error;
pub type Result<T = Response, E = anyhow::Error> = anyhow::Result<T, E>;
pub use context::Context;
pub use extract::Extract;
pub use guard::Guard;
pub use handler::{Handler, HandlerBase, HandlerCamp, HandlerSuper, HandlerWrapper};
pub use middleware::{DynMiddleware, Middlewares};
pub use response::Response;
#[macro_export]
macro_rules! reject {
($err:expr) => {
return Err(how!($err));
};
}
#[macro_export]
macro_rules! how {
($err:expr) => {
Into::<Error>::into(Into::<Response>::into($err))
};
}
pub use anyhow::{anyhow, bail, ensure};