3 ms·
Yes, that would be ideal. Was just thinking whether the const generics can be hacked to do the same thing.
by ww520 5y ago
Yes, that would be ideal. Was just thinking whether the const generics can be hacked to do the same thing.
- estebank 5y agoYou can't use field access today, so having a const param `struct Range<T> { start: T, end: T }` isn't yet useful, but you can still get something working, although the error message is terrible: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c77cd060bcfa4e95c439e9d48996542a https://play.rust-lang.org/?version=nightly&mode=debug&editi... Edit: I'm honestly surprised at how usable this is already in the current state of nightly: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=f60ab9c71a5c91f709e82c13f9cf851a https://play.rust-lang.org/?version=nightly&mode=debug&editi...
- ww520 5y agoExcellent hack! This demonstrates it actually works. Just need to make it ergonomic for everyday work. That's awesome.