6 releases (3 breaking)

0.4.2 Apr 7, 2024
0.4.1 Jan 2, 2024
0.4.0 Mar 30, 2023
0.3.0 Jan 3, 2022
0.1.0 Jun 7, 2021

#27 in #trillium

Download history 31/week @ 2024-01-29 6/week @ 2024-02-05 93/week @ 2024-02-12 38/week @ 2024-02-19 105/week @ 2024-02-26 22/week @ 2024-03-04 60/week @ 2024-03-11 51/week @ 2024-03-18 56/week @ 2024-03-25 196/week @ 2024-04-01 302/week @ 2024-04-08 82/week @ 2024-04-15 28/week @ 2024-04-22 27/week @ 2024-04-29 44/week @ 2024-05-06 31/week @ 2024-05-13

131 downloads per month
Used in trillium-sessions

MIT/Apache

67KB
936 lines

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:

the trillium cookie handler

example

use trillium::Conn;
use trillium_cookies::{cookie::Cookie, CookiesConnExt, CookiesHandler};
async fn handler_that_uses_cookies(conn: Conn) -> Conn {
let content = if let Some(cookie_value) = conn.cookies().get("some_cookie") {
format!("current cookie value: {}", cookie_value.value())
} else {
String::from("no cookie value set")
};

conn.with_cookie(("some_cookie", "some-cookie-value")).ok(content)
}

let handler = (CookiesHandler::new(), handler_that_uses_cookies);

use trillium_testing::prelude::*;

assert_ok!(
get("/").on(&handler),
"no cookie value set",
"set-cookie" => "some_cookie=some-cookie-value"
);

assert_ok!(
get("/").with_request_header("cookie", "some_cookie=trillium").on(&handler),
"current cookie value: trillium",
"set-cookie" => "some_cookie=some-cookie-value"
);

Dependencies

~8.5MB
~204K SLoC