Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RegKey::encode_transacted #55

Closed
wants to merge 2 commits into from

Conversation

dnlmlr
Copy link
Contributor

@dnlmlr dnlmlr commented Jun 26, 2023

  • The RegKey::encode_transacted allows for encoding a serializable value using an existing transaction
  • To make this work, a few changes were made to Encoder and Transaction
  • Transaction now implements AsRef which shouldn't change anything
  • Encoder now stores a generic AsRef instead of a fully owned Transaction
  • This allows for two implementations, one is the existing one that owns the transaction and commits it on drop, the other only has a borrowed transaction that will not cause a commit on drop
  • This way an existing transaction can be used
  • Also added an example for transacted_serialization

- The RegKey::encode_transacted allows for encoding a serializable value
  using an existing transaction
- To make this work, a few changes were made to Encoder and Transaction
- Transaction now implements AsRef<Transaction> which shouldn't change
  anything
- Encoder now stores a generic AsRef<Transaction> instead of a fully
  owned Transaction
- This allows for two implementations, one is the existing one that owns
  the transaction and commits it on drop, the other only has a borrowed
  transaction that will not cause a commit on drop
- This way an existing transaction can be used
- Also added an example for transacted_serialization
@gentoo90
Copy link
Owner

Could you please add a test for this into tests/serialization.rs?

@dnlmlr
Copy link
Contributor Author

dnlmlr commented Jun 27, 2023

I copied the existing 2 tests and changed them to use encode_transacted with a new transaction

@gentoo90
Copy link
Owner

Rebased onto winapi branch and released in versions 0.12.0 and 0.51.0

@gentoo90 gentoo90 closed this Aug 19, 2023
@dnlmlr dnlmlr deleted the feature-encode-transacted branch August 20, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants