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

Potential solution for get_mut without requiring runtime checking (e.g. RefCell) #60

Open
AshleySchaeffer opened this issue Aug 11, 2023 · 1 comment

Comments

@AshleySchaeffer
Copy link

AshleySchaeffer commented Aug 11, 2023

Based on a brief exchange with @Kestrer:

#31 (comment)

After a quick look, I think it would require a fairly significant API rework that employs the use of guards (perhaps ThreadLocalGuard and ThreadLocalMutGuard) that could maybe impl Deref and DerefMut to the underlying value. In much the same way as IterMut is implemented:

https://docs.rs/thread_local/latest/src/thread_local/lib.rs.html#468-471

Scratch that, I think I may have a working implementation.

Nope, yeah I think guards may be needed

@AshleySchaeffer
Copy link
Author

OK after a fundamental Rust refresher, I think my original comment is partly correct. However, you have to also add a get_inner_mut method. I'll see if I can do a PR.

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

No branches or pull requests

1 participant