Skip to content

Commit 77cd2ab

Browse files
committed
refactor: add and use default impl for OnTransactionDrop
1 parent 2ac8f0b commit 77cd2ab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/transaction.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ pub struct Transaction<'a> {
4747
/// committing - i.e., [`OnTransactionDrop::Commit`] - the transaction!
4848
///
4949
/// [1]: https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction
50-
#[derive(Debug, Copy, Clone)]
50+
#[derive(Debug, Copy, Clone, Default)]
5151
pub enum OnTransactionDrop {
5252
/// Abort the [`Transaction`] when it is dropped. This is the default
5353
/// behavior of [`Transaction`].
54+
#[default]
5455
Abort,
5556
/// Commit the [`Transaction`] when it is dropped. This is the default
5657
/// behavior of an [`IDBTransaction`][1] in JavaScript.
@@ -87,7 +88,7 @@ impl<'a> Transaction<'a> {
8788
Self {
8889
listeners: TxListeners::new(db, inner),
8990
done: false,
90-
on_drop: OnTransactionDrop::Abort,
91+
on_drop: OnTransactionDrop::default(),
9192
}
9293
}
9394

0 commit comments

Comments
 (0)