Struct headers_ext::Cookie [−][src]
pub struct Cookie(_);
Cookie
header, defined in RFC6265
If the user agent does attach a Cookie header field to an HTTP request, the user agent must send the cookie-string as the value of the header field.
When the user agent generates an HTTP request, the user agent MUST NOT attach more than one Cookie header field.
Example values
SID=31d4d96e407aad42
SID=31d4d96e407aad42; lang=en-US
Methods
impl Cookie
[src]
impl Cookie
pub fn get(&self, name: &str) -> Option<&str>
[src]
pub fn get(&self, name: &str) -> Option<&str>
Lookup a value for a cookie name.
Example
use headers::{Cookie, HeaderMap, HeaderMapExt, HeaderValue}; // Setup the header map with strings... let mut headers = HeaderMap::new(); headers.insert("cookie", HeaderValue::from_static("lang=en-US")); // Parse a `Cookie` so we can play with it... let cookie = headers .typed_get::<Cookie>() .expect("we just inserted a valid Cookie"); assert_eq!(cookie.get("lang"), Some("en-US")); assert_eq!(cookie.get("SID"), None);
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Get the number of key-value pairs this Cookie
contains.
pub fn iter(
&self
) -> impl Iterator<Item = (&str, &str)>
[src]
pub fn iter(
&self
) -> impl Iterator<Item = (&str, &str)>
Iterator the key-value pairs of this Cookie
header.
Trait Implementations
impl Clone for Cookie
[src]
impl Clone for Cookie
fn clone(&self) -> Cookie
[src]
fn clone(&self) -> Cookie
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Debug for Cookie
[src]
impl Debug for Cookie