-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Feature request: Custom destructuring #78154
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
Comments
Hi! Additions or changes to the language need to go through our RFC process. Before an RFC is written, the feature can also be discussed in our internals forum to find other people interested in it. Closing in favor of an RFC. |
Why can't the discussion be here? Other feature requests are already being discussed on GitHub, like https://github.com/rust-lang/rust/issues/78064, which is only two days old (and also does not have an RFC yet). Fun fact, I actually intended to post the feature request there instead of here - but I actually couldn't find the internals forum, and got confused after seeing that the users forum had no feature requests (/language design) category! I had no idea the two were separate :/ |
It depends on the magnitude of the feature request, and the team decides what requests are too large to be discussed here. #78161 should help future users find IRLO for largeish requests. |
So that is the issue then, this request is too large? Could you please elaborate more on why? |
The RFCs repo and internals forum were deliberately created to house design work and discussion. This issue tracker is meant mostly for bugs.
We sometimes don't consistently apply rules to the issue tracker, because they aren't written down anywhere and people often miss things (since it is almost impossible to keep up with every issue that is filed here). |
That sounds a little unfair, then. Fine, I will go post a duplicate on the forum. Eventually. |
I have no authority here, it's just how I see things normally work :P but probably the main reason is, as jonas pointed out, that it's hard to keep up and it's all subjective. In any case don't take this personally, a quick search for the text above reveals more issues closed with the same reasoning. |
A few of those issues were obviously joke requests (like "remove semicolons" begging Rust to be more like python). Most likely the comment was used there to close the issue more professionally than "not in a million years". I don't see how my issue fits into that category, but in any case there's no point in arguing about it here. I'll move to the forum. |
Let's say I have this struct,
Vec2
:And I also a tuple containing two
Vec2
s:Right now, I have to do this to destructure it, which is really long and cumbersome to type:
I thought it would be a lot nicer if I could do this instead:
But after asking for help in the Rust Discord, it looks like this is impossible!
Should support for custom destructuring like this be added? Is it even possible?
It could work like this:
Or it could use the existing
Into
/AsRef
/AsMut
traits instead, thoughts?The text was updated successfully, but these errors were encountered: