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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! # Trillium server adapter for async-std
//!
//! ```rust,no_run
//! # #[allow(clippy::needless_doctest_main)]
//! fn main() {
//! trillium_async_std::run(|conn: trillium::Conn| async move { conn.ok("hello async-std") });
//! }
//! ```
//!
//! ```rust,no_run
//! # #[allow(clippy::needless_doctest_main)]
//! #[async_std::main]
//! async fn main() {
//! trillium_async_std::run_async(
//! |conn: trillium::Conn| async move { conn.ok("hello async-std") },
//! )
//! .await;
//! }
//! ```
use Handler;
pub use ;
pub use ClientConfig;
pub use async_std;
use Config;
pub use AsyncStdTransport;
/// # Runs a trillium handler in a sync context with default config
///
/// Runs a trillium handler on the async-std runtime with default
/// configuration. See [`crate::config`] for what the defaults are and how
/// to override them
///
///
/// This function will block the current thread until the server shuts
/// down
/// # Runs a trillium handler in an async context with default config
///
/// Run the provided trillium handler on an already-running async-std
/// runtime with default settings. the defaults are the same as
/// [`crate::run`]. To customize these settings, see [`crate::config`].
///
/// This function will poll pending until the server shuts down.
pub async
/// # Configures a server before running it
///
/// ## Defaults
///
/// The default configuration is as follows:
///
/// port: the contents of the `PORT` env var or else 8080
/// host: the contents of the `HOST` env var or else "localhost"
/// signals handling and graceful shutdown: enabled on cfg(unix) systems
/// tcp nodelay: disabled
/// tls acceptor: none
///
/// ## Usage
///
/// ```rust
/// let swansong = trillium_async_std::Swansong::new();
/// # swansong.shut_down(); // stoppping the server immediately for the test
/// trillium_async_std::config()
/// .with_port(0)
/// .with_host("127.0.0.1")
/// .without_signals()
/// .with_nodelay()
/// .with_acceptor(()) // see [`trillium_rustls`] and [`trillium_native_tls`]
/// .with_swansong(swansong)
/// .run(|conn: trillium::Conn| async move { conn.ok("hello async-std") });
/// ```
///
/// See [`trillium_server_common::Config`] for more details
pub use AsyncStdRuntime;
pub use AsyncStdUdpSocket;