tank_core/
transaction.rs

1use crate::{Executor, Result};
2
3/// A mutable transactional context implementing [`Executor`].
4///
5/// Consuming methods (`commit`, `rollback`) finalize the transaction. Dropping
6/// without explicit finalization should implicitly rollback, prefer an explicit
7/// choice for clarity.
8pub trait Transaction<'c>: Executor {
9    /// Commit the outstanding changes.
10    fn commit(self) -> impl Future<Output = Result<()>>;
11    /// Rollback any uncommitted changes.
12    fn rollback(self) -> impl Future<Output = Result<()>>;
13}