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

Document @ syntax in pattern matching #11563

Closed
andrew-3kb opened this issue Jan 15, 2014 · 1 comment
Closed

Document @ syntax in pattern matching #11563

andrew-3kb opened this issue Jan 15, 2014 · 1 comment

Comments

@andrew-3kb
Copy link

There is a really useful feature currently in the match expression:

match foo {
    ref mut a @ Something(_) => something_else(a),
    ...
}

if you don't know what it does it binds the entire thing matched to a variable, so in the above case something_else will be called with a mutable reference to foo if it meets the pattern Something(_).

The feature seems really useful but it's currently not documented anywhere, I guess someone should document it.

@huonw
Copy link
Member

huonw commented Jan 15, 2014

Thanks for the report.

You are correct that it is undocumented; in fact, this was already noted in #7173.

@huonw huonw closed this as completed Jan 15, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 25, 2023
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

2 participants