pub struct SetCookie {
pub name: String,
pub value: String,
pub path: Option<String>,
pub domain: Option<String>,
pub max_age: Option<i64>,
pub secure: bool,
pub http_only: bool,
pub same_site: Option<String>,
}Expand description
Builder for the Set-Cookie response header value.
§Example
use rust_web_server::cookie::SetCookie;
let header_value = SetCookie::new("session", "abc123")
.path("/")
.http_only()
.secure()
.same_site("Lax")
.build();
assert!(header_value.starts_with("session=abc123"));
assert!(header_value.contains("HttpOnly"));Fields§
§name: String§value: String§path: Option<String>§domain: Option<String>§max_age: Option<i64>§secure: bool§http_only: bool§same_site: Option<String>Implementations§
Source§impl SetCookie
impl SetCookie
pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self
pub fn path(self, path: impl Into<String>) -> Self
pub fn domain(self, domain: impl Into<String>) -> Self
pub fn max_age(self, seconds: i64) -> Self
pub fn secure(self) -> Self
pub fn http_only(self) -> Self
pub fn same_site(self, policy: impl Into<String>) -> Self
Auto Trait Implementations§
impl Freeze for SetCookie
impl RefUnwindSafe for SetCookie
impl Send for SetCookie
impl Sync for SetCookie
impl Unpin for SetCookie
impl UnsafeUnpin for SetCookie
impl UnwindSafe for SetCookie
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more