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(Data, Debug, Clone, Default, PartialEq, Eq)]
8pub struct CookieBuilder {
9    /// Cookie name identifier.
10    #[set(type(AsRef<str>))]
11    pub(super) name: CookieKey,
12    /// Cookie value content.
13    #[set(type(AsRef<str>))]
14    pub(super) value: CookieValue,
15    /// Optional expiration date/time string.
16    #[set(skip)]
17    pub(super) expires: Option<String>,
18    /// Optional maximum age in seconds.
19    #[set(skip)]
20    pub(super) max_age: Option<i64>,
21    /// Optional domain scope for the cookie.
22    #[set(skip)]
23    pub(super) domain: Option<String>,
24    /// Optional path scope for the cookie.
25    #[set(skip)]
26    pub(super) path: Option<String>,
27    /// Optional flag indicating secure (HTTPS-only) transmission.
28    #[set(skip)]
29    pub(super) secure: Option<bool>,
30    /// Optional flag preventing JavaScript access.
31    #[set(skip)]
32    pub(super) http_only: Option<bool>,
33    /// Optional SameSite policy setting.
34    #[set(skip)]
35    pub(super) same_site: Option<String>,
36}
37
38/// Parser for HTTP Cookie headers.
39///
40/// Provides functionality to parse Cookie header strings into key-value pairs.
41#[derive(Debug, Clone, Default, PartialEq, Eq)]
42pub struct Cookie;