Crate trillium_smol

source ·
Expand description

Trillium adapter using smol and async-global-executor

Default / 12-factor applications

trillium_smol::run(|conn: trillium::Conn| async move {
    conn.ok("hello smol")

Server configuration

For more details, see trillium_smol::config.

let stopper = trillium_smol::Stopper::new();
    .with_acceptor(()) // see [`trillium_rustls`] and [`trillium_native_tls`]
    .run(|conn: trillium::Conn| async move {
        conn.ok("hello smol")


trillium_testing::with_server("ok", |url| async move {
    use trillium_smol::TcpConnector;
    use trillium_client::{Conn, Client};
    let mut conn = Conn::<TcpConnector>::get(url.clone()).execute().await?;
    assert_eq!(conn.response_body().read_string().await?, "ok");

    let client = Client::<TcpConnector>::new().with_default_pool();
    let mut conn = client.get(url);
    assert_eq!(conn.response_body().read_string().await?, "ok");


  • pub use async_global_executor;
  • pub use async_io;
  • pub use async_net;


  • 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
  • A transport newtype for smol
  • This struct provides a synchronized mechanism for canceling Futures and Streams.


  • 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).


  • 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 ()