pub struct Cookie;Expand description
Parser for HTTP Cookie headers.
Provides functionality to parse Cookie header strings into key-value pairs.
Implementations§
Source§impl Cookie
Implementation for Cookie.
impl Cookie
Implementation for Cookie.
Sourcepub fn find_value<'a>(cookie: &'a str, target_name: &str) -> Option<&'a str>
pub fn find_value<'a>(cookie: &'a str, target_name: &str) -> Option<&'a str>
Finds the first valid cookie value matching target_name without allocating a map.
Applies the exact same RFC 6265 validation and first-match precedence as Cookie::parse.
§Arguments
&'a str- RawCookieheader string.&str- Cookie name to search for.
§Returns
Option<&'a str>- Borrowed cookie value slice if found and valid.
Sourcepub fn parse<C>(cookie: C) -> HashMapXxHash3_64<String, String>
pub fn parse<C>(cookie: C) -> HashMapXxHash3_64<String, String>
Parses a Cookie header string into a collection of key-value pairs.
This method takes a Cookie header string (typically from a Cookie request header)
and parses it into a map of cookie names to their values.
A pair whose name is not a token and a pair whose value carries a control byte are skipped, because RFC 6265 Section 4.1.1 admits neither, and a name that carries a separator would let the rest of the name be read as part of the value.
§Arguments
C- TheCookieheader string to parse, which requires theAsRef<str>bound.
§Returns
A HashMapXxHash3_64<String, String> collection (a hash map) containing all parsed cookie key-value pairs.