13 releases

new 0.4.1 Apr 13, 2024
0.3.3 Jan 2, 2024
0.3.1 Sep 13, 2023
0.3.0 Apr 21, 2023
0.1.4 Jul 26, 2021

#17 in #trillium

Download history 59/week @ 2023-12-22 221/week @ 2023-12-29 231/week @ 2024-01-05 53/week @ 2024-01-12 148/week @ 2024-01-19 78/week @ 2024-01-26 31/week @ 2024-02-02 109/week @ 2024-02-09 59/week @ 2024-02-16 81/week @ 2024-02-23 107/week @ 2024-03-01 65/week @ 2024-03-08 55/week @ 2024-03-15 93/week @ 2024-03-22 215/week @ 2024-03-29 235/week @ 2024-04-05

601 downloads per month
Used in 8 crates

MIT/Apache

385KB
7.5K SLoC

Welcome to Trillium!

📖 Guide 📖

The guide provides an architectural overview and lay of the land connecting the trillium crates.

📑 Rustdocs 📑

The rustdocs represent the best way to learn about any of trillium's individual crates and the specific interfaces.




Legal:

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

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();
trillium_smol::config()
.with_port(0)
.with_host("127.0.0.1")
.without_signals()
.with_nodelay()
.with_acceptor(()) // see [`trillium_rustls`] and [`trillium_native_tls`]
.with_stopper(stopper)
.run(|conn: trillium::Conn| async move {
conn.ok("hello smol")
});

Client

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);
conn.send().await?;
assert_eq!(conn.response_body().read_string().await?, "ok");
Ok(())
});

Dependencies

~11–23MB
~403K SLoC