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

Remove interior mutability from Rng #47

Merged
merged 1 commit into from
Feb 13, 2023
Merged

Remove interior mutability from Rng #47

merged 1 commit into from
Feb 13, 2023

Conversation

notgull
Copy link
Member

@notgull notgull commented Feb 11, 2023

This PR removes interior mutability from the Rng type by removing the Cell from inside of it and making all of its methods take &mut. This closes #31, and also helps with #36 as a side effect, since we can't call u64() anymore from &self.

This is a breaking change, but resolving most of our current issues would require a breaking change as well.

Closes #26
Closes #38

@taiki-e
Copy link
Collaborator

taiki-e commented Feb 12, 2023

LGTM, but we may want to create a new 1.x release that includes #35 before merging this.

@taiki-e
Copy link
Collaborator

taiki-e commented Feb 12, 2023

I think this will also close #26 and #38.

closes #36 as a side effect

To close it, perhaps we may want to add a fork function with the same behavior as the current clone.

@notgull
Copy link
Member Author

notgull commented Feb 12, 2023

LGTM, but we may want to create a new 1.x release that includes #35 before merging this.

Cool, I opened #48

@notgull notgull merged commit 0e0209a into master Feb 13, 2023
@notgull notgull deleted the notgull/mut branch February 13, 2023 03:57
@notgull
Copy link
Member Author

notgull commented Feb 13, 2023

#48 is closed, so I'll merge this. More changes to come.

@notgull notgull mentioned this pull request Apr 7, 2023
notgull added a commit that referenced this pull request Jun 9, 2023
- **Breaking:** Remove interior mutability from `Rng`. (#47)
- Add a `fork()` method. (#49)
- Add a `no_std` mode. (#50)
- Add an iterator selection function. (#51)
- Add a `choose_multiple()` function for sampling several elements from an iterator. (#55)
- Use the `getrandom` crate for seeding on WebAssembly targets if the `js` feature is enabled. (#60)
Pi-Cla pushed a commit to Pi-Cla/cargo-mommy that referenced this pull request Jan 3, 2025
In particular fastrand to v2 which requires Rng to be mutable due to smol-rs/fastrand#47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Remove Internal Mutability
2 participants