Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Patterns can be arbitrarily complex. If you have

  struct Foo {
      bar: Arc<String>,
  }
Then it's the difference between today's

  if let Foo { bar } = val {
      if &*bar == "hi" {
      }
  }
And the potential future

  if let Foo { bar: "hi" } = val {}
The more complex the pattern, the bigger the conciseness win and levels of nesting you can remove. This comes up more often for me with `Box`, in the context of AST nodes, but because I use nightly I can use `box` patterns, which is the same feature but only for `Box` and that will never be stabilized.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: