http_type/cookie/struct.rs
1use crate::*;
2
3/// Builder for constructing HTTP cookies.
4///
5/// Provides methods to set various cookie attributes like expiration,
6/// domain, path, and security flags before building the final cookie string.
7#[derive(Debug, Clone, Default, PartialEq, Eq, Data)]
8pub struct CookieBuilder<'a> {
9 /// Cookie name identifier.
10 pub(super) name: CookieKey<'a>,
11 /// Cookie value content.
12 pub(super) value: CookieValue<'a>,
13 /// Expiration date/time string.
14 #[new(skip)]
15 pub(super) expires: &'a str,
16 /// Maximum age in seconds.
17 #[new(skip)]
18 pub(super) max_age: i64,
19 /// Domain scope for the cookie.
20 #[new(skip)]
21 pub(super) domain: &'a str,
22 /// Path scope for the cookie.
23 #[new(skip)]
24 pub(super) path: &'a str,
25 /// Flag indicating secure (HTTPS-only) transmission.
26 #[new(skip)]
27 pub(super) secure: bool,
28 /// Flag preventing JavaScript access.
29 #[new(skip)]
30 pub(super) http_only: bool,
31 /// SameSite policy setting.
32 #[new(skip)]
33 pub(super) same_site: &'a str,
34}
35
36/// Parser for HTTP Cookie headers.
37///
38/// Provides functionality to parse Cookie header strings into key-value pairs.
39#[derive(Debug, Clone, Default, PartialEq, Eq)]
40pub struct Cookie;