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]

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);

Get the number of key-value pairs this Cookie contains.

Iterator the key-value pairs of this Cookie header.

Trait Implementations

impl Clone for Cookie
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Cookie
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Cookie

impl Sync for Cookie