pub enum CookieDomain {
HostOnly(String),
Suffix(String),
NotPresent,
Empty,
}
Expand description
The domain of a Cookie
Variants§
HostOnly(String)
No Domain attribute in Set-Cookie header
Suffix(String)
Domain attribute from Set-Cookie header
NotPresent
Domain attribute was not present in the Set-Cookie header
Empty
Domain attribute-value was empty; technically undefined behavior, but suggested that this be treated as invalid
Implementations§
source§impl CookieDomain
impl CookieDomain
The concept of a domain match per IETF RFC6265 Section 5.1.3
sourcepub fn host_only(request_url: &Url) -> Result<CookieDomain, CookieError>
pub fn host_only(request_url: &Url) -> Result<CookieDomain, CookieError>
Get the CookieDomain::HostOnly variant based on request_url
. This is the effective behavior of
setting the domain-attribute to empty
sourcepub fn matches(&self, request_url: &Url) -> bool
pub fn matches(&self, request_url: &Url) -> bool
Tests if the given url::Url
meets the domain-match criteria
sourcepub fn host_is_identical(&self, request_url: &Url) -> bool
pub fn host_is_identical(&self, request_url: &Url) -> bool
Tests if the given url::Url
has a request-host identical to the domain attribute
sourcepub fn is_public_suffix(&self, psl: &List) -> bool
pub fn is_public_suffix(&self, psl: &List) -> bool
Tests if the domain-attribute is a public suffix as indicated by the provided
publicsuffix::List
.
Trait Implementations§
source§impl Clone for CookieDomain
impl Clone for CookieDomain
source§fn clone(&self) -> CookieDomain
fn clone(&self) -> CookieDomain
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CookieDomain
impl Debug for CookieDomain
source§impl<'de> Deserialize<'de> for CookieDomain
impl<'de> Deserialize<'de> for CookieDomain
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>,
source§impl<'a> From<&'a CookieDomain> for String
impl<'a> From<&'a CookieDomain> for String
source§fn from(c: &'a CookieDomain) -> String
fn from(c: &'a CookieDomain) -> String
source§impl Hash for CookieDomain
impl Hash for CookieDomain
source§impl Ord for CookieDomain
impl Ord for CookieDomain
source§fn cmp(&self, other: &CookieDomain) -> Ordering
fn cmp(&self, other: &CookieDomain) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for CookieDomain
impl PartialEq for CookieDomain
source§impl PartialOrd for CookieDomain
impl PartialOrd for CookieDomain
source§impl Serialize for CookieDomain
impl Serialize for CookieDomain
source§impl<'a, 'c> TryFrom<&'a Cookie<'c>> for CookieDomain
impl<'a, 'c> TryFrom<&'a Cookie<'c>> for CookieDomain
Construct a CookieDomain::Suffix
from a cookie::Cookie
, which handles stripping a leading
‘.’ for us. If the cookie.domain is None or an empty string, the CookieDomain::Empty
variant
is returned.
NOTE: cookie::Cookie
domain values already have the leading ‘.’ stripped. To avoid
performing this step twice, the From<&cookie::Cookie>
impl should be used,
instead of passing cookie.domain
to the From<&str>
impl.
source§impl<'a> TryFrom<&'a str> for CookieDomain
impl<'a> TryFrom<&'a str> for CookieDomain
Construct a CookieDomain::Suffix
from a string, stripping a single leading ‘.’ if present.
If the source string is empty, returns the CookieDomain::Empty
variant.
impl Eq for CookieDomain
impl StructuralPartialEq for CookieDomain
Auto Trait Implementations§
impl Freeze for CookieDomain
impl RefUnwindSafe for CookieDomain
impl Send for CookieDomain
impl Sync for CookieDomain
impl Unpin for CookieDomain
impl UnwindSafe for CookieDomain
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)