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 new<N, V>(name: N, value: V) -> CookieBuilder
pub fn new<N, V>(name: N, value: V) -> CookieBuilder
Sourcepub fn parse<C>(cookie: C) -> CookieBuilder
pub fn parse<C>(cookie: C) -> CookieBuilder
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 expires<E>(&mut self, expires: E) -> &mut CookieBuilder
pub fn expires<E>(&mut self, expires: E) -> &mut CookieBuilder
Sourcepub fn max_age(&mut self, max_age: i64) -> &mut CookieBuilder
pub fn max_age(&mut self, max_age: i64) -> &mut CookieBuilder
Sourcepub fn domain<D>(&mut self, domain: D) -> &mut CookieBuilder
pub fn domain<D>(&mut self, domain: D) -> &mut CookieBuilder
Sourcepub fn path<T>(&mut self, path: T) -> &mut CookieBuilder
pub fn path<T>(&mut self, path: T) -> &mut CookieBuilder
Sourcepub fn secure(&mut self) -> &mut CookieBuilder
pub fn secure(&mut self) -> &mut CookieBuilder
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 CookieBuilder
pub fn http_only(&mut self) -> &mut CookieBuilder
Sets the HttpOnly flag for the cookie.
This flag prevents client-side JavaScript from accessing the cookie.
§Returns
The CookieBuilder instance for method chaining.
Sourcepub fn same_site<T>(&mut self, same_site: T) -> &mut CookieBuilder
pub fn same_site<T>(&mut self, same_site: T) -> &mut CookieBuilder
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