pub struct Cookie { /* private fields */ }Expand description
A cookie to send with Response::with_cookie.
Implementations§
Source§impl Cookie
impl Cookie
Sourcepub fn new(name: impl Into<String>, value: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self
A cookie with safe defaults: HttpOnly, SameSite=Lax, Path=/.
Sourcepub fn removal(name: impl Into<String>) -> Self
pub fn removal(name: impl Into<String>) -> Self
A cookie that deletes an existing one of the same name.
Path must match the cookie being removed, so set it if the original
used something other than /.
Sourcepub fn http_only(self, yes: bool) -> Self
pub fn http_only(self, yes: bool) -> Self
Set HttpOnly — script cannot read the cookie. On by default.
Sourcepub fn to_header_value(&self) -> String
pub fn to_header_value(&self) -> String
Render the Set-Cookie header value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cookie
impl RefUnwindSafe for Cookie
impl Send for Cookie
impl Sync for Cookie
impl Unpin for Cookie
impl UnsafeUnpin for Cookie
impl UnwindSafe for Cookie
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