[−][src]Struct headers::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]
pub fn get(&self, name: &str) -> Option<&str>
[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);
pub fn len(&self) -> usize
[src]
Get the number of key-value pairs this Cookie
contains.
pub fn iter(
&self
) -> impl Iterator<Item = (&str, &str)>
[src]
&self
) -> impl Iterator<Item = (&str, &str)>
Iterator the key-value pairs of this Cookie
header.
Trait Implementations
impl Clone for Cookie
[src]
fn clone(&self) -> Cookie
[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 Header for Cookie
[src]
fn name() -> &'static HeaderName
[src]
fn decode<'i, I>(values: &mut I) -> Result<Self, Error> where
I: Iterator<Item = &'i HeaderValue>,
[src]
I: Iterator<Item = &'i HeaderValue>,
fn encode<E: Extend<HeaderValue>>(&self, values: &mut E)
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Same for T
type Output = T
Should always be Self