-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add OwnedRwLockReadGuard and OwnedRwLockWriteGuard #3340
Conversation
I've rebased on #3348 now. |
I did not add mapping functions as it's not possible to implement them soundly without adding another generic parameter to the guards, which I will leave to another PR. Fixes: tokio-rs#3327
0d64150
to
67244da
Compare
After another rebase, it should finally be good to review now. I didn't choose the best of times to make this PR 😅. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for the delay in reviewing. I don't have any comments besides the one below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems ok to me.
I did not add mapping functions as it's not possible to implement them soundly without adding another generic parameter to the guards, which I will leave to another PR. I implemented
OwnedRwLockWriteGuard::downgrade
as a method becauseRwLockWriteGuard::downgrade
is a method - but that was probably a mistake, so I'm not sure.Fixes: #3327
Motivation
The feature is already present for mutexes, and it is useful in some scenarios with
RwLock
s.Solution
Add
OwnedRwLockReadGuard
andOwnedRwLockWriteGuard
, which are variants ofRwLockReadGuard
andRwLockWriteGuard
that store anArc
.