pub struct CookieBuilder { /* private fields */ }
Expand description
Builder for constructing HTTP cookies.
Provides methods to set various cookie attributes like expiration, domain, path, and security flags before building the final cookie string.
Implementations§
Source§impl CookieBuilder
Implementation for CookieBuilder
.
impl CookieBuilder
Implementation for CookieBuilder
.
Sourcepub fn parse(cookie_string: &str) -> Self
pub fn parse(cookie_string: &str) -> Self
Parses a Set-Cookie
header string into a CookieBuilder
.
This method takes a Set-Cookie
header string and extracts the various
attributes of a cookie, populating a CookieBuilder
instance.
§Arguments
&str
- TheSet-Cookie
header string to parse.
§Returns
A CookieBuilder
instance populated with the parsed cookie attributes.
Sourcepub fn secure(&mut self) -> &mut Self
pub fn secure(&mut self) -> &mut Self
Sets the Secure
flag for the cookie.
This flag indicates that the cookie should only be transmitted over secure (HTTPS) connections.
§Returns
The CookieBuilder
instance for method chaining.
Sourcepub fn http_only(&mut self) -> &mut Self
pub fn http_only(&mut self) -> &mut Self
Sets the HttpOnly
flag for the cookie.
This flag prevents client-side JavaScript from accessing the cookie.
§Returns
The CookieBuilder
instance for method chaining.
Trait Implementations§
Source§impl Clone for CookieBuilder
impl Clone for CookieBuilder
Source§fn clone(&self) -> CookieBuilder
fn clone(&self) -> CookieBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more