this post was submitted on 10 Nov 2024
15 points (100.0% liked)

Rust

6851 readers
1 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
 

In order to share the running transaction into a DAO style data management class, I have wrapped the transaction in an Arc and pass it into the DAO.

The issue is, once the transaction is in there I cannot call commit() on it because it cannot be moved out of the Arc anymore, as the commit requires a mut self.

Any ideas on how to work around this?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 9 points 5 months ago (9 children)

This screams of XY problem. You've gotten a new problem from using this method and you're asking for help for that, but probably there is an underlying better solution that solves your actual use case without running into this problem at all.

[โ€“] [email protected] 1 points 5 months ago (8 children)

So your answer is "you are doing it wrong".

Thank you, very helpful ๐Ÿ˜‰

[โ€“] [email protected] 8 points 5 months ago (7 children)

That's not what I said. Read about the XY problem and then come back and explain what you actually want to achieve, and give some more information like code examples.

load more comments (6 replies)
load more comments (6 replies)
load more comments (6 replies)