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

Use a RefCell to provide interior mutability for VolumeManager. #143

Merged
merged 8 commits into from
Oct 12, 2024

Conversation

thejpster
Copy link
Member

@thejpster thejpster commented Oct 6, 2024

VolumeManager now contains a RefCell, so all the methods can be &self. This also means you can have multiple smart handles usable at the same time.

Note that VolumeManager is !Sync, so this is just about having multiple File objects active at one time.

Closes #79 (finally!)

jannic
jannic previously approved these changes Oct 11, 2024
Copy link
Contributor

@jannic jannic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer the change to try_borrow_mut, unless I'm missing some reason why that wouldn't be easily possible.

Otherwise, LGTM.

src/volume_mgr.rs Outdated Show resolved Hide resolved
@thejpster
Copy link
Member Author

I rebased.

@thejpster
Copy link
Member Author

Rust is brilliant. I had very little trouble chopping up this codebase and hacking on that shell example to use the auto-closing Directory objects. If it compiles, it has basically worked.

@thejpster thejpster force-pushed the interior-mutability branch from 6caee8d to 2b5a863 Compare October 11, 2024 21:54
@thejpster
Copy link
Member Author

Rebased again 😢

Make small PRs, they said. It's easier to review, they said.

@thejpster thejpster force-pushed the interior-mutability branch 2 times, most recently from f29b9f7 to f6eb622 Compare October 11, 2024 21:58
@jannic
Copy link
Contributor

jannic commented Oct 11, 2024

Make small PRs, they said. It's easier to review, they said.

Don't worry. It is easier to review!

jannic
jannic previously approved these changes Oct 11, 2024
@thejpster
Copy link
Member Author

I wonder if I should turn off the thing that dismisses reviews as stale when a commit is added.

@thejpster
Copy link
Member Author

OK, all rebased and notes added about double locking. I think this monster is good to go.

This was referenced Oct 12, 2024
@thejpster thejpster added this pull request to the merge queue Oct 12, 2024
Merged via the queue into develop with commit d33233d Oct 12, 2024
8 checks passed
@thejpster thejpster deleted the interior-mutability branch October 12, 2024 17:15
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.

Explore interior mutability
2 participants