Expand description
§use-cookie
Small cookie utilities for RustUse.
§Experimental
use-cookie is experimental while the use-web workspace remains below 0.3.0. Expect small API adjustments during the first release wave.
§Example
use use_cookie::{get_cookie, parse_set_cookie_basic};
assert_eq!(get_cookie("session=abc; theme=dark", "theme").as_deref(), Some("dark"));
assert!(parse_set_cookie_basic("session=abc; Path=/; HttpOnly").is_some());§Scope
- Cookie header parsing and formatting.
- Lightweight
Set-Cookieinspection for common attributes. - Small validation helpers for cookie names.
§Non-goals
- Browser cookie jars.
- Public suffix handling.
- Security policy engines.
- Session management.
§License
Licensed under either of the following, at your option:
- Apache License, Version 2.0
- MIT license
Structs§
- Cookie
- A cookie name-value pair from the
Cookieheader. - SetCookie
- A lightweight view of a
Set-Cookieheader.
Functions§
- build_
cookie_ header - Builds a
Cookieheader string from cookie pairs. - cookie_
name_ is_ valid - Returns
truewhen the cookie name uses a conservative HTTP token character set. - get_
cookie - Returns the first cookie value with the requested name.
- has_
cookie - Returns
truewhen the header contains the requested cookie. - parse_
cookie_ header - Parses a
Cookieheader into cookie pairs. - parse_
set_ cookie_ basic - Parses a lightweight
Set-Cookieheader.