Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 7dd0c8fd02c9c5faa03ec6ffd7b6c3cea0e73afc
parent 9750ae67dd929c4ee09d198338a719e662eae4c6
Author: Eric Dattore <eric.dattore@gmail.com>
Date:   Tue, 11 Dec 2018 13:57:23 -0800

Implement 'DerefMut' for database pools.

This commit also fixes database pool codegen amidst of generics.

Fixes #854.
Resolves #862.

Diffstat:
Mcontrib/codegen/src/database.rs | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/contrib/codegen/src/database.rs b/contrib/codegen/src/database.rs @@ -91,7 +91,7 @@ pub fn database_attr(attr: TokenStream, input: TokenStream) -> Result<TokenStrea ::rocket::fairing::AdHoc::on_attach(#fairing_name, |rocket| { let pool = #databases::database_config(#name, rocket.config()) - .map(#connection_type::pool); + .map(<#connection_type>::pool); match pool { Ok(Ok(p)) => Ok(rocket.manage(#pool_type(p))), @@ -130,6 +130,13 @@ pub fn database_attr(attr: TokenStream, input: TokenStream) -> Result<TokenStrea } } + impl ::std::ops::DerefMut for #request_guard_type { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } + } + impl<'a, 'r> #request::FromRequest<'a, 'r> for #request_guard_type { type Error = ();