Given what they're saying I assume they're trying to match both the entire value and the sub-values e.g.
xs@(_:xs')
> You also don't need to take ownership of a value. You can match on a reference to it with &.
`ref` is what you'd use in a pattern though, `&` would deref' a reference so usually it'd be to Copy a Copy type which is provided behind a ref'.
I see. Yes, it appears to be either-or for now.
> `ref` is what you'd use in a pattern though
Not in the pattern, in the "argument". Like this: https://rust.godbolt.org/z/eT366s
pub fn f(v: &Option<String>) { match &v { other => eprintln!("Doesn't move {:?}", other), } }
Given what they're saying I assume they're trying to match both the entire value and the sub-values e.g.
in Haskell. Stable Rust currently lets you use at-patterns and perform assertions on the sub-pattern, but not match there.> You also don't need to take ownership of a value. You can match on a reference to it with &.
`ref` is what you'd use in a pattern though, `&` would deref' a reference so usually it'd be to Copy a Copy type which is provided behind a ref'.