-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
as_deref_mut()
method for Mut-like types
#9912
Conversation
I feel like |
I agree tbh, but I didn't think of it until the PR ready haha. Updated the PR. I didn't add an |
set_deref_if_neq
methodas_deref_mut()
method for Mut-like types
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.
I didn't add an as_deref method because there isn't really a point of a Mut that isn't mutable
I agree, a Ref
variant is unnecessary. Similarly, we have map_unchanged
for Mut
but not for Ref
. Generally there's just less of a need to map Ref
since it doesn't trigger anything when dereferenced.
Co-authored-by: Joseph <[email protected]>
Thank you both! 🙏 |
# Objective Add a new method so you can do `set_if_neq` with dereferencing components: `as_deref_mut()`! ## Solution Added an as_deref_mut method so that we can use `set_if_neq()` without having to wrap up types for derefencable components --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Joseph <[email protected]>
# Objective Add a new method so you can do `set_if_neq` with dereferencing components: `as_deref_mut()`! ## Solution Added an as_deref_mut method so that we can use `set_if_neq()` without having to wrap up types for derefencable components --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Joseph <[email protected]>
# Objective Add a new method so you can do `set_if_neq` with dereferencing components: `as_deref_mut()`! ## Solution Added an as_deref_mut method so that we can use `set_if_neq()` without having to wrap up types for derefencable components --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Joseph <[email protected]>
# Objective Add a new method so you can do `set_if_neq` with dereferencing components: `as_deref_mut()`! ## Solution Added an as_deref_mut method so that we can use `set_if_neq()` without having to wrap up types for derefencable components --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Joseph <[email protected]>
Objective
Add a new method so you can do
set_if_neq
with dereferencing components:as_deref_mut()
!Solution
Added an as_deref_mut method so that we can use
set_if_neq()
without having to wrap up types for derefencable components