3 ms·
I would kill to have a monadic slicing API for Vec<T>, though. It seems like the one significant exception to the "use whichever works better for you" argument.
by dikaiosune 10y ago
I would kill to have a monadic slicing API for Vec<T>, though. It seems like the one significant exception to the "use whichever works better for you" argument. Of course you can bounds check yourself first and return Err if there's a problem, but there's also no get_unchecked() for slices so you'd pay for the checks twice.
- Sean1708 10y ago> but there's also no get_unchecked() for slices so you'd pay for the checks twice. Yeah there is[1], unless I'm being really stupid... [1]: https://doc.rust-lang.org/std/primitive.slice.html#method.get_unchecked https://doc.rust-lang.org/std/primitive.slice.html#method.ge...
- dikaiosune 10y agoRather, there's no get_unchecked to get a slice from a Vec. Unlike index, get_unchecked can't take a range as input.
- Sean1708 10y agoAh gotcha, sounds like it could be a good first RFC for someone.
- dikaiosune 10y agoI'll add it to my long list of rust projects I wish I had time to do :).