mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 07:04:22 +00:00
b7cdd93f3e
More APIs for `la_arena::IdxRange` ```rust impl<T> ExactSizeIterator for IdxRange<T>; impl<T> Arena<T> { pub fn alloc_many<II: IntoIterator<Item = T>>(&mut self, iter: II) -> IdxRange<T>; } ``` 1. There are no currently ways to get `IdxRange` without manually offseting `Idx`. Providing a method for multiple-allocation simplifies this process and makes it less error-prone. 2. `IdxRange: ExactSizeIterator` makes `iter.zip(range).rev()` possible. Since `Zip: DoubleEndedIterator` requires all its arguments to be `ExactSizeIterator`. It also ease the usage for, eg. `len()`. 3. Fixed a typo. I noticed that `IdxRange::end` may be invalid. Is it good to return `Idx` instead of `RawIdx`? |
||
---|---|---|
.. | ||
la-arena | ||
line-index | ||
lsp-server | ||
README.md |