Skip to content

Commit

Permalink
impl RefExecutor for &mut E ( where E is RefExecutor ) to allow &mut …
Browse files Browse the repository at this point in the history
…&Pool to continue working in 0.3
  • Loading branch information
mehcode committed Mar 2, 2020
1 parent 59c99ae commit 56c0fc3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sqlx-core/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,22 @@ where
(**self).describe(query)
}
}

// The following impl lets `&mut &Pool` continue to work
// This pattern was required in SQLx < 0.3
// Going forward users will likely naturally use `&Pool` instead

impl<'c, T> RefExecutor<'c> for &'c mut T
where
T: Copy + RefExecutor<'c>,
{
type Database = T::Database;

#[inline]
fn fetch_by_ref<'q, E>(self, query: E) -> <Self::Database as HasCursor<'c, 'q>>::Cursor
where
E: Execute<'q, Self::Database>,
{
(*self).fetch_by_ref(query)
}
}

0 comments on commit 56c0fc3

Please sign in to comment.