Skip to content

Commit

Permalink
.commit() and .rollback() now consume the transaction
Browse files Browse the repository at this point in the history
Fixes #62
  • Loading branch information
gentoo90 committed Nov 19, 2023
1 parent fa2f1c8 commit 0fd5bb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Encoder<Transaction> {
}
}

pub fn commit(&mut self) -> EncodeResult<()> {
pub fn commit(self) -> EncodeResult<()> {
self.tr.commit().map_err(EncoderError::IoError)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Transaction {
}
}

pub fn commit(&self) -> io::Result<()> {
pub fn commit(self) -> io::Result<()> {
unsafe {
match ktmw32::CommitTransaction(self.handle) {
0 => Err(io::Error::last_os_error()),
Expand All @@ -78,7 +78,7 @@ impl Transaction {
}
}

pub fn rollback(&self) -> io::Result<()> {
pub fn rollback(self) -> io::Result<()> {
unsafe {
match ktmw32::RollbackTransaction(self.handle) {
0 => Err(io::Error::last_os_error()),
Expand Down

0 comments on commit 0fd5bb8

Please sign in to comment.