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

Consider making RefMut::new public when raw-api is enabled #248

Open
SnowyCoder opened this issue Jan 17, 2023 · 0 comments
Open

Consider making RefMut::new public when raw-api is enabled #248

SnowyCoder opened this issue Jan 17, 2023 · 0 comments

Comments

@SnowyCoder
Copy link

Currently, trough the raw-api feature a lot of custom APIs can be built.
There is though no easy way to replicate what DashMap::_get and DashMap::_get_mut do internally since Ref::new and RefMut::new are pub(crate) only.

Is there any specific reason on why they are not pub?

What brought me to open this issue is that i would want an atomic key-swap operation that returns a mutable reference to the moved value, this operation is too specific to mainline but having a public RefMut::new would make it easy to build it using extension traits.

Leaked implementation details

This change should not expose too many implementation details since shards and shard lock guards are already exposed (using the raw-api feature).

Compatibility

Adding a function to an already existing struct is listed by the rust documentation as "Possibly-breaking change" (found here) but I doubt that anybody extended Ref/RefMut with a new method.

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