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<C>(cookie: C) -> Self
pub fn parse<C>(cookie: C) -> 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
AsRef<str>- TheSet-Cookieheader 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.
Source§impl CookieBuilder
impl CookieBuilder
pub fn get_name(&self) -> &CookieKey
pub fn get_value(&self) -> &CookieValue
pub fn get_expires(&self) -> &Option<String>
pub fn get_max_age(&self) -> &Option<i64>
pub fn get_domain(&self) -> &Option<String>
pub fn get_path(&self) -> &Option<String>
pub fn get_secure(&self) -> &bool
pub fn get_http_only(&self) -> &bool
pub fn get_same_site(&self) -> &Option<String>
Source§impl CookieBuilder
impl CookieBuilder
pub fn get_mut_name(&mut self) -> &mut CookieKey
pub fn get_mut_value(&mut self) -> &mut CookieValue
pub fn get_mut_expires(&mut self) -> &mut Option<String>
pub fn get_mut_max_age(&mut self) -> &mut Option<i64>
pub fn get_mut_domain(&mut self) -> &mut Option<String>
pub fn get_mut_path(&mut self) -> &mut Option<String>
pub fn get_mut_secure(&mut self) -> &mut bool
pub fn get_mut_http_only(&mut self) -> &mut bool
pub fn get_mut_same_site(&mut self) -> &mut Option<String>
Source§impl CookieBuilder
impl CookieBuilder
pub fn set_name(&mut self, val: CookieKey) -> &mut Self
pub fn set_value(&mut self, val: CookieValue) -> &mut Self
pub fn set_expires(&mut self, val: Option<String>) -> &mut Self
pub fn set_max_age(&mut self, val: Option<i64>) -> &mut Self
pub fn set_domain(&mut self, val: Option<String>) -> &mut Self
pub fn set_path(&mut self, val: Option<String>) -> &mut Self
pub fn set_secure(&mut self, val: bool) -> &mut Self
pub fn set_http_only(&mut self, val: bool) -> &mut Self
pub fn set_same_site(&mut self, val: Option<String>) -> &mut Self
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