Rust 1.55.0
blog.rust-lang.org
blog.rust-lang.org
I don't even program in Rust myself and I've still heard of the term "Turbofish". Rest in peace, Anna
If this operator had been introduced in a corporate language like Swiftlang, it would be the butt of jokes, but community languages like Rust can get away with this by using a cutesy name and everyone is simply too afraid to criticise Rust as they will be the target of intense group-hate.
> The standard library's implementation of float parsing has been updated to use the Eisel-Lemire algorithm, which brings both speed improvements and improved correctness. In the past, certain edge cases failed to parse, and this has now been fixed.
> You can read more details on the new implementation in the pull request description: https://github.com/rust-lang/rust/pull/86761
There's some pretty big speed improvements there. 3x-10x in the most normal cases, 1600x on some edge cases, and stdlib is now capable of parsing the floats that it never used to be able to.
- Handles the iterator not being the same size as the array you want to collect the iterator into and turns it into some sort of Result<[T; N], ArrayCollectError>.
- By itself knows the exact size of the iterator as part of the iterator type and thus can ensure via the type system that the iterator has exactly as many elements as the array needs.
std::array::IntoIter<T, N> already satisfies that requirement. The result of mapping over a std::array::IntoIter<T, N> should be std::iter::Map<array::IntoIter<T, N>, F>, which also has the number of elements at the type level and even inherits ExactSizeIterator from array::IntoIter. The problem, I think, is that ExactSizeIterator only says that the size is known at run time; there is no "ConstSizeIterator<N>" trait which would witness that the exact size is known at compile time. If there were then you could potentially collect the items from a ConstSizeIterator<N> (which could be implemented by array::IntoIter<T, N> and inherited by iter::Map<array::IntoIter<T, N>, F>) into an array of N elements without any runtime checks or allocation.
But yes in the end this is all done in the stack
We could have an inline version of map (for arrays and Vec) if we had a way to assert that two types have the same size. This means we can reuse the buffer because all elements will fit.
https://github.com/rust-lang/rfcs/issues/2848#issuecomment-8...