Re:Announcing Rust 1.9
by dikaiosune on Thursday May 26, 2016 @11:36PM
(#11783731)
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.
[ Parent
| on HN ]
> 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.ge...
Re:Announcing Rust 1.9
by dikaiosune on Friday May 27, 2016 @12:31PM
(#11787101)
Rather, there's no get_unchecked to get a slice from a Vec. Unlike index, get_unchecked can't take a range as input.
Ah gotcha, sounds like it could be a good first RFC for someone.
Re:Announcing Rust 1.9
by dikaiosune on Saturday May 28, 2016 @01:58AM
(#11790738)
I'll add it to my long list of rust projects I wish I had time to do :).