[][src]Struct hyper::header::CookieJar

pub struct CookieJar<'a> where
    'a: 'a, 
{ /* fields omitted */ }

A jar of cookies for managing a session

Example

use cookie::{Cookie, CookieJar};

let c = CookieJar::new(b"f8f9eaf1ecdedff5e5b749c58115441e");

// Add a cookie to this jar
c.add(Cookie::new("key".to_string(), "value".to_string()));

// Remove the added cookie
c.remove("key");

Methods

impl<'a> CookieJar<'a>
[src]

Creates a new empty cookie jar with the given signing key.

The given key is used to sign cookies in the signed cookie jar.

Adds an original cookie from a request.

This method only works on the root cookie jar and is not intended for use during the lifetime of a request, it is intended to initialize a cookie jar from an incoming request.

Adds a new cookie to this cookie jar.

If this jar is a child cookie jar, this will walk up the chain of borrowed jars, modifying the cookie as it goes along.

Removes a cookie from this cookie jar.

Finds a cookie inside of this cookie jar.

The cookie is subject to modification by any of the child cookie jars that are currently borrowed. A copy of the cookie is returned.

Creates a child signed cookie jar.

All cookies read from the child jar will require a valid signature and all cookies written will be signed automatically.

Example

let c = CookieJar::new(b"f8f9eaf1ecdedff5e5b749c58115441e");

// Add a signed cookie to the jar
c.signed().add(Cookie::new("key".to_string(), "value".to_string()));

// Add a permanently signed cookie to the jar
c.permanent().signed()
 .add(Cookie::new("key".to_string(), "value".to_string()));

Creates a child encrypted cookie jar.

All cookies read from the child jar must be encrypted and signed by a valid key and all cookies written will be encrypted and signed automatically.

Example

let c = CookieJar::new(b"f8f9eaf1ecdedff5e5b749c58115441e");

// Add a signed and encrypted cookie to the jar
c.encrypted().add(Cookie::new("key".to_string(), "value".to_string()));

// Add a permanently signed and encrypted cookie to the jar
c.permanent().encrypted()
 .add(Cookie::new("key".to_string(), "value".to_string()));

Creates a child jar for permanent cookie storage.

All cookies written to the child jar will have an expiration date 20 years into the future to ensure they stick around for a long time.

Calculates the changes that have occurred to this cookie jar over time, returning a vector of Set-Cookie headers.

Return an iterator over the cookies in this jar.

This iterator will only yield valid cookies for this jar. For example if this is an encrypted child jar then only valid encrypted cookies will be yielded. If the root cookie jar is iterated over then all cookies will be yielded.

Auto Trait Implementations

impl<'a> !Send for CookieJar<'a>

impl<'a> !Sync for CookieJar<'a>

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<T> Typeable for T where
    T: Any
[src]

Get the TypeId of this object.