3 ms·
I have good news for you then-- there already is some experimental[0] work towards this, under the name of "pattern types" (although I believe it's on pause at
by mbStavola 3y ago
I have good news for you then-- there already is some experimental[0] work towards this, under the name of "pattern types" (although I believe it's on pause at the moment). The idea seems to be to pull some of the pattern semantics into the type system, allowing for more than just range types, based on a series of blog posts[1] by the author of the PR. Additionally, Yoshua Wuyts has another blog post[2] which gives a decent intro on the concept and what it could be used for down the line.
[1]: https://github.com/rust-lang/rust/pull/107606 https://github.com/rust-lang/rust/pull/107606
[2]: https://cohost.org/oli-obk/post/165584-ranged-integers-via https://cohost.org/oli-obk/post/165584-ranged-integers-via
[3]: https://blog.yoshuawuyts.com/pattern-extensions/#pattern-types https://blog.yoshuawuyts.com/pattern-extensions/#pattern-typ...