Crate trillium_tokio
source ·Expand description
Trillium server adapter for tokio
fn main() {
trillium_tokio::run(|conn: trillium::Conn| async move {
conn.ok("hello tokio")
});
}
#[tokio::main]
async fn main() {
trillium_tokio::run_async(|conn: trillium::Conn| async move {
conn.ok("hello tokio")
}).await;
}
Re-exports
pub use async_compat;
pub use tokio;
pub use tokio_stream;
Structs
- configuration for the tcp Connector
- An observer that can be cloned without modifying the clone counter, but can be used to inspect its state and awaited
- This struct provides a synchronized mechanism for canceling Futures and Streams.
- A transport newtype for tokio
Enums
- A wrapper enum that has blanket implementations for common traits like TryFrom, Stream, AsyncRead, and AsyncWrite. This can contain listeners (like TcpListener), Streams (like Incoming), or bytestreams (like TcpStream).
Functions
- reexport tokio runtime block_on
- Configures a server before running it
- Runs a trillium handler in a sync context with default config
- Runs a trillium handler in an async context with default config
- spawn and detach a Future that returns ()