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 {
9    /// Cookie name identifier.
10    pub(super) name: CookieKey,
11    /// Cookie value content.
12    pub(super) value: CookieValue,
13    /// Optional expiration date/time string.
14    #[new(skip)]
15    pub(super) expires: Option<String>,
16    /// Optional maximum age in seconds.
17    #[new(skip)]
18    pub(super) max_age: Option<i64>,
19    /// Optional domain scope for the cookie.
20    #[new(skip)]
21    pub(super) domain: Option<String>,
22    /// Optional path scope for the cookie.
23    #[new(skip)]
24    pub(super) path: Option<String>,
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    /// Optional SameSite policy setting.
32    #[new(skip)]
33    pub(super) same_site: Option<String>,
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;