Rust has a proposal for this, in the form of pattern types. It's on nightly, but quite far from being ready for prime time.