4 ms·
const generics themselves will only become stable in the upcoming release, 1.51. This release only adds implementations of specific traits to arrays of all leng
by est31 6y ago
const generics themselves will only become stable in the upcoming release, 1.51. This release only adds implementations of specific traits to arrays of all lengths. Users themselves can't declare types yet that are generic on numbers or write impl blocks generic on numbers.
- staticassertion 6y agoAh! Bummer, but also, that's enough to deal with what felt like a big inconsistency in Rust - inability to work well with arrays.
- conradludgate 6y agoI'm already using them in nightly and they are amazing. The only thing left that I want with generics is variadics/tuples. The only way currently to implement a trait over a generic tuple is to write a macro and call it for however many sized tuples you want. I've not seen any convincing RFCs about it yet though so I'm not confident we'll get them any time soon
- remexre 6y agoI use https://docs.rs/frunk/0.3.1/frunk/ https://docs.rs/frunk/0.3.1/frunk/ to get around this in the meantime.
- PoignardAzur 6y agoI wouldn't call it a convincing RFC, but I did recently write an analysis on the subject: https://gist.github.com/PoignardAzur/aea33f28e2c58ffe1a93b8f8d3c58667 https://gist.github.com/PoignardAzur/aea33f28e2c58ffe1a93b8f...
- felipellrocha 6y agoI hit this limitation recently, and although it was a bummer, it’s good to hear that a solution is being worked on