Skip to content

Commit

Permalink
fix(cookies): adjust required bounds to compile on beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryman committed Jul 4, 2015
1 parent 869735c commit b9a4843
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cookies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use cookie::CookieJar;
pub struct SecretKey(pub [u8; 32]);

// Plugin boilerplate
struct CookiePlugin;
pub struct CookiePlugin;
impl Key for CookiePlugin { type Value = CookieJar<'static>; }

impl<'a, 'b, 'k, D> Plugin<Request<'a, 'b, 'k, D>> for CookiePlugin
Expand Down Expand Up @@ -61,16 +61,16 @@ impl<'a, D> AllowMutCookies for Response<'a, D> {}
/// #Examples
/// See `examples/cookies_example.rs`.
pub trait Cookies : Pluggable + Extensible
where CookiePlugin: Plugin<Self, Value=CookieJar<'static>, Error=()> {
where CookiePlugin: Plugin<Self, Error=()> {
/// Provides access to an immutable CookieJar.
///
/// Currently requires a mutable reciever, hopefully this can change in future.
fn cookies(&mut self) -> &CookieJar {
fn cookies(&mut self) -> &<CookiePlugin as Key>::Value {
self.get_ref::<CookiePlugin>().unwrap()
}

/// Provides access to a mutable CookieJar.
fn cookies_mut(&mut self) -> &mut CookieJar<'static> where Self: AllowMutCookies {
fn cookies_mut(&mut self) -> &mut <CookiePlugin as Key>::Value where Self: AllowMutCookies {
self.get_mut::<CookiePlugin>().unwrap()
}
}
Expand Down

0 comments on commit b9a4843

Please sign in to comment.