pub struct Cookie {Show 13 fields
pub name: String,
pub value: String,
pub domain: String,
pub path: String,
pub secure: bool,
pub http_only: bool,
pub same_site: Option<SameSite>,
pub expires: Option<DateTime<Utc>>,
pub max_age: Option<i64>,
pub host_only: bool,
pub source_url: Option<String>,
pub raw_header: Option<String>,
pub creation_time: DateTime<Utc>,
}Expand description
RFC 6265 compliant cookie representation.
Fields§
§name: String§value: String§domain: String§path: String§secure: bool§http_only: bool§same_site: Option<SameSite>§expires: Option<DateTime<Utc>>§max_age: Option<i64>§host_only: bool§source_url: Option<String>§raw_header: Option<String>§creation_time: DateTime<Utc>Creation time for sorting per RFC 6265 Section 5.4
Implementations§
Source§impl Cookie
impl Cookie
pub fn new( name: impl Into<String>, value: impl Into<String>, domain: impl Into<String>, ) -> Self
Sourcepub fn with_secure(self, secure: bool) -> Self
pub fn with_secure(self, secure: bool) -> Self
Builder-style method to set the secure flag.
Sourcepub fn with_http_only(self, http_only: bool) -> Self
pub fn with_http_only(self, http_only: bool) -> Self
Builder-style method to set the http_only flag.
Sourcepub fn with_same_site(self, same_site: SameSite) -> Self
pub fn with_same_site(self, same_site: SameSite) -> Self
Builder-style method to set the same_site attribute.
Sourcepub fn with_expires(self, expires: DateTime<Utc>) -> Self
pub fn with_expires(self, expires: DateTime<Utc>) -> Self
Builder-style method to set the expires time.
Sourcepub fn with_host_only(self, host_only: bool) -> Self
pub fn with_host_only(self, host_only: bool) -> Self
Builder-style method to set the host_only flag.
pub fn matches_url(&self, url: &str) -> bool
Sourcepub fn domain_matches(&self, request_domain: &str) -> bool
pub fn domain_matches(&self, request_domain: &str) -> bool
RFC 6265 Section 5.1.3: Domain Matching Returns true if request_domain matches this cookie’s domain.
Sourcepub fn path_matches(&self, request_path: &str) -> bool
pub fn path_matches(&self, request_path: &str) -> bool
RFC 6265 Section 5.1.4: Path Matching Returns true if request_path matches this cookie’s path.
pub fn to_netscape_line(&self) -> String
pub fn from_netscape_line(line: &str) -> Result<Self>
pub fn value_hash(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Cookie
impl<'de> Deserialize<'de> for Cookie
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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