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
pub mod common;
pub mod log;
pub mod web2;

use web2::{aop, context, gateway, http1, tcp, utils, server};

pub use http1::http;
pub use utils::middleware::{Middleware, Next};
pub use utils::request::Request;
pub use utils::response::Response;
pub use utils::response_builder::ResponseBuilder;
pub use utils::util;

pub use server::endpoint::Endpoint;
pub use gateway::route::Route;
pub use http_types::{self, Body, Error, Status, StatusCode};

use web2::server::server::Server;

#[must_use]
pub fn new() -> Server<()> {
    Server::new()
}

/// 自动扫描 日志开启 读取yml
#[must_use]
pub fn run() -> Server<()> {
    Server::run()
}

pub fn with_state<State>(state: State) -> Server<State>
where
    State: Clone + Send + Sync + 'static,
{
    Server::with_state(state)
}

/// 结果类型处理
pub type Result<T = Response> = std::result::Result<T, Error>;

pub mod rt;

/// 建立过程宏与summer boot的关联
macro_rules! macro_reexport {
    ($name:ident) => {
        #[cfg(feature = "macros")]
        #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
        pub use summer_boot_macro::$name;
    };
}

macro_reexport!(auto_scan);
macro_reexport!(main);
macro_reexport!(post);
macro_reexport!(get);
macro_reexport!(delete);
macro_reexport!(put);
macro_reexport!(head);
macro_reexport!(options);
macro_reexport!(connect);
macro_reexport!(patch);
macro_reexport!(trace);