rust/library
Guillaume Gomez 7f787e397c
Rollup merge of #94667 - frank-king:feature/iter_map_windows, r=Mark-Simulacrum
Add `Iterator::map_windows`

Tracking issue:  #87155.

This is inherited from the old PR  #82413.

Unlike #82413, this PR implements the `MapWindows` to be lazy: only when pulling from the outer iterator, `.next()` of the inner iterator will be called.

## Implementaion Steps
- [x] Implement `MapWindows` to keep the iterators' [*Laziness*](https://doc.rust-lang.org/std/iter/index.html#laziness) contract.
- [x] Fix the known bug of memory access error.
- [ ] Full specialization of iterator-related traits for `MapWindows`.
    - [x] `Iterator::size_hint`,
    - [x] ~`Iterator::count`~,
    - [x] `ExactSizeIterator` (when `I: ExactSizeIterator`),
    - [x] ~`TrustedLen` (when `I: TrustedLen`)~,
    - [x] `FusedIterator`,
    - [x] ~`Iterator::advance_by`~,
    - [x] ~`Iterator::nth`~,
    - [ ] ...
- [ ] More tests and docs.

## Unresolved Questions:
- [ ] Is there any more iterator-related traits should be specialized?
- [ ] Is the double-space buffer worth?
- [ ] Should there be `rmap_windows` or something else?
- [ ] Taking GAT for consideration, should the mapper function be `FnMut(&[I::Item; N]) -> R` or something like `FnMut(ArrayView<'_, I::Item, N>) -> R`? Where `ArrayView` is mentioned in https://github.com/rust-lang/generic-associated-types-initiative/issues/2.
    - It can save memory, only the same size as the array window is needed,
    - It is more efficient, which requires less data copies,
    - It is possibly compatible with the GATified version of `LendingIterator::windows`.
    - But it prevents the array pattern matching like `iter.map_windows(|_arr: [_; N]| ())`, unless we extend the array pattern to allow matching the `ArrayView`.
2023-08-13 21:00:44 +02:00
..
alloc Rollup merge of #114402 - tifv:tifv-fix-rc-doc, r=cuviper 2023-08-10 21:17:37 -07:00
backtrace@e1c49fbd61 Update std to backtrace 0.3.68 2023-07-02 17:02:45 -07:00
core Rollup merge of #94667 - frank-king:feature/iter_map_windows, r=Mark-Simulacrum 2023-08-13 21:00:44 +02:00
panic_abort Add internal_features lint 2023-08-03 14:50:50 +02:00
panic_unwind stabilize abi_thiscall 2023-08-07 14:11:03 +02:00
portable-simd remove repetitive words 2023-07-31 16:13:02 +08:00
proc_macro Add internal_features lint 2023-08-03 14:50:50 +02:00
profiler_builtins Add internal_features lint 2023-08-03 14:50:50 +02:00
rtstartup Remove custom frame info registration on i686-pc-windows-gnu 2022-08-23 16:12:58 +08:00
rustc-std-workspace-alloc Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #114132 - tamird:better-env-debug-impls, r=Amanieu 2023-08-12 12:06:35 +02:00
stdarch@d77878b729 Bump stdarch 2023-06-13 21:45:04 -07:00
sysroot Expose compiler-builtins-weak-intrinsics feature for -Zbuild-std 2023-06-23 11:15:34 +01:00
test Rollup merge of #114377 - Enselic:test_get_dbpath_for_term-utf-8, r=thomcc 2023-08-09 22:59:58 +02:00
unwind Add internal_features lint 2023-08-03 14:50:50 +02:00