Skip to content

Commit c7f578e

Browse files
committed
Remove unnecessary &mut from begin_transaction()
Transaction::new() only needs &Database (not &mut) because: - We only call db.clone() which doesn't mutate the Database - All transaction operations go through the C API via get_ref() - This makes the API more flexible - no need for mutable Database This allows usage like: let db = Database::open("test", None)?; // immutable let transaction = db.begin_transaction()?; // works now
1 parent 9e992ac commit c7f578e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/database.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl Database {
358358
/// it will be rolled back when dropped.
359359
///
360360
/// For simpler cases, consider using `in_transaction()` instead.
361-
pub fn begin_transaction(&mut self) -> Result<Transaction> {
361+
pub fn begin_transaction(&self) -> Result<Transaction> {
362362
Transaction::new(self)
363363
}
364364

0 commit comments

Comments
 (0)