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

The concept of a domain match per IETF RFC6265 Section 5.1.3

Get the CookieDomain::HostOnly variant based on request_url. This is the effective behavior of setting the domain-attribute to empty

Tests if the given url::Url meets the domain-match criteria

Tests if the given url::Url has a request-host identical to the domain attribute

Tests if the domain-attribute is a public suffix as indicated by the provided publicsuffix::List.

Get a borrowed string representation of the domain. For Empty and NotPresent variants, None shall be returned;

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

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.

The type returned in the event of a conversion error.

Performs the conversion.

Construct a CookieDomain::Suffix from a string, stripping a single leading ‘.’ if present. If the source string is empty, returns the CookieDomain::Empty variant.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.