Merge pull request #322 from traviscross/improvement/add-comment-about-mut-connection

Add comment to justify `&mut Connection` in `Transaction`
This commit is contained in:
gwenn 2018-03-24 03:04:42 +01:00 committed by GitHub
commit 64d401ba19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,6 +94,9 @@ pub struct Savepoint<'conn> {
impl<'conn> Transaction<'conn> {
/// Begin a new transaction. Cannot be nested; see `savepoint` for nested transactions.
// Even though we don't mutate the connection, we take a `&mut Connection`
// so as to prevent nested or concurrent transactions on the same
// connection.
pub fn new(conn: &mut Connection, behavior: TransactionBehavior) -> Result<Transaction> {
let query = match behavior {
TransactionBehavior::Deferred => "BEGIN DEFERRED",