-
Notifications
You must be signed in to change notification settings - Fork 12
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
Rc as rcref #10
Rc as rcref #10
Conversation
* no documentation yet, only a stub to stop the error
This looks interesting overall, and I think that the reborrows are indeed safe. As you mention, this should drastically increase the flexibility of the types, which looks quite useful. I am not sure whether this would require an "experimental" flag, or not. It seems relatively tame (unlike lift, which is outright dodgy) and very much in line with existing functions which are not marked as such. In the end, I am left only with nits:
Looking forward to getting this merged :) |
I also think the names should be reconsidered. I would like the names to reflect the similarity between the functions. Maybe |
Reformat documentation
Naming is hard :( I find I do agree that aligning the names would be neat; I don't have much spare brain power right now, though, so I wouldn't hold back the PR on that. It's not stable, we can always change the names later if a better idea pops up. |
I believe that's it :) |
Don't panic! I wanted to squash, rebase, and reword the commit message to be more inline with the style used by the other commit messages... and I couldn't find a way to do it from Github. So I did it locally -- and painstakingly, I'm really no good at advanced workflows -- while managing to preserve attribution. I didn't quite know how to update this PR from there, so I just pushed from my local checkout to master; and therefore this PR's code is in, even if this PR is closed. Thanks for your work! |
This pull request adds a feature allowing
StaticRc
andStaticRcRef
to be frozen in order to temporarily create a newStaticRcRef
that has the same "ratio" of a&mut T
. Since the original is frozen, the overall ownership of the&mut T
is still preserved. This can allow changing a value through separateStaticRc
s stored in different parts while not having to constantly move them around.Honestly I'm not sure how useful it is, because I haven't had time to check yet, but I have a feeling this can be used to improve some of the data structures that can currently be implemented using
static_rc
.I'm pretty sure this is sound, but this does "allow" more than 1 overall ownership at a single time. But it isn't supposed to matter since only 1 overall ownership is usable at any single time. Perhaps you would like to put this under an experimental feature for now?
The pull request is currently missing tests, except the two doctests.