-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking Issue for Exclusive
#98407
Comments
This is probably a bikeshed, but perhaps the This does make it asymmetric with |
@clarfonthey that would conflict with https://doc.rust-lang.org/std/pin/struct.Pin.html#method.get_mut |
To provide some motivation I have been using a more limited internal version of this for about 3 years in |
@Nemo157 I think we should try to get this in at 1.66, next week ill take a look at writing a stabilization report |
Hi! I've submitted PR #104057, with a few small changes:
I would be happy to write a stabilization PR when this passes an FCP. |
For the same reason that I don't know if it would be that useful (even ignoring that there's been some disucssion about deprecating |
Interestingly, in bevyengine/bevy#7718, they are adding a method called |
The method above is quite useful for us, but is a contradiction with the This is quite a useful type, and it would be a shame to see something limited get locked in via stabilization. (summarized from conversation in the Bevy Discord). |
I agree that |
I don't think |
The main issue with using the What we have is some sort of static mutex, but I'm not sure if using that terminology is helpful either. |
I agree that the I think the name should emphasize the fact that the purpose of this type is to gurantee |
We should just name it |
Is it possible (and how) to make
|
You could also "cheat" by implementing traits that have read-only methods specifically for |
I don't think that would work? If you have a Well, Trying to implement <&mut Exclusive as Iterator>::size_hint normallyimpl<I: ?Sized + Iterator> Iterator for &mut Exclusive<I> {
type Item = I::Item;
fn next(&mut self) -> Option<I::Item> {
self.get_mut().next() // this is fine
}
fn size_hint(&self) -> (usize, Option<usize>) {
self.get_mut().size_hint()
// cannot borrow `**self` as mutable, as it is behind a `&` reference
}
} |
…right, initially I thought that reborrows of the initial |
Feature gate:
#![feature(exclusive_wrapper)]
This is a tracking issue for the
Exclusive
wrapper struct.This structure can be used to upgrade non-
Sync
objects intoSync
ones, by only offering mutable access to the underlying object. This can be useful withSend
-but-not-Sync
futures (likeBoxFuture
s)Public API
Steps / History
Exclusive
to sync #97629Unresolved Questions
The text was updated successfully, but these errors were encountered: