pub struct Cookie {
pub name: String,
pub value: String,
pub path: Option<String>,
pub domain: Option<String>,
pub max_age: Option<Duration>,
pub expires: Option<SystemTime>,
pub http_only: Option<bool>,
pub secure: Option<bool>,
pub same_site: Option<SameSite>,
pub partitioned: bool,
}Expand description
A cookie to set.
Unless configured explicitly, cookies set through Cookies::set get
Path=/, HttpOnly, SameSite=Lax, and Secure outside development.
Fields§
§name: String§value: String§path: Option<String>§domain: Option<String>§max_age: Option<Duration>§expires: Option<SystemTime>§http_only: Option<bool>§secure: Option<bool>§same_site: Option<SameSite>§partitioned: boolImplementations§
Source§impl Cookie
impl Cookie
pub fn new(name: impl Into<String>, value: impl Into<String>) -> Cookie
Sourcepub fn encoded(name: impl Into<String>, value: &str) -> Cookie
pub fn encoded(name: impl Into<String>, value: &str) -> Cookie
Percent-encode value so it may contain any text. Read it back with
Cookies::get_decoded.
pub fn path(self, v: impl Into<String>) -> Cookie
pub fn domain(self, v: impl Into<String>) -> Cookie
pub fn max_age(self, v: Duration) -> Cookie
pub fn expires(self, v: SystemTime) -> Cookie
pub fn http_only(self, v: bool) -> Cookie
pub fn secure(self, v: bool) -> Cookie
pub fn same_site(self, v: SameSite) -> Cookie
pub fn partitioned(self, v: bool) -> Cookie
Sourcepub fn to_header_value(&self) -> Result<String, CookieError>
pub fn to_header_value(&self) -> Result<String, CookieError>
Serialize as a Set-Cookie header value.
Trait Implementations§
impl Eq for Cookie
impl StructuralPartialEq for Cookie
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.