Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .get(range) #891

Merged
merged 10 commits into from
May 14, 2024
Merged

Commits on May 14, 2024

  1. Add Itertools::get with IteratorIndex

    Co-Authored-By: wod3 <17980899+wod3@users.noreply.github.com>
    Philippe-Cholet and wod3 committed May 14, 2024
    Configuration menu
    Copy the full SHA
    a6766fd View commit details
    Browse the repository at this point in the history
  2. Suggestions

    Co-Authored-By: TrolledWoods <26680270+trolledwoods@users.noreply.github.com>
    Philippe-Cholet and TrolledWoods committed May 14, 2024
    Configuration menu
    Copy the full SHA
    b190bfc View commit details
    Browse the repository at this point in the history
  3. Small fixes

    Fix my own review.
    Update docs.
    Fix a warning with `#[cfg(doc)]`.
    Use public path `traits::IteratorIndex` instead of private path `iter_index::IteratorIndex`.
    Philippe-Cholet committed May 14, 2024
    Configuration menu
    Copy the full SHA
    6451862 View commit details
    Browse the repository at this point in the history
  4. Test Itertools::get laziness

    As we should, I checked it can't pass without `let _ =`.
    Philippe-Cholet committed May 14, 2024
    Configuration menu
    Copy the full SHA
    ed2feb7 View commit details
    Browse the repository at this point in the history
  5. Remove the unspecified check about .get(exhausted_range_inclusive)

    `RangeInclusive::is_empty` (rust 1.47+) is in conflict with our MSRV (1.43.1) so we can't use it yet.
    The unspecified behavior is documented in `Itertools::get` so we simply remove this.
    Philippe-Cholet committed May 14, 2024
    Configuration menu
    Copy the full SHA
    6f48e32 View commit details
    Browse the repository at this point in the history
  6. get(r: Range) as Skip<Take>

    Unless there is a reason to prefer `Take<Skip>` over `Skip<Take>`?!
    Philippe-Cholet committed May 14, 2024
    Configuration menu
    Copy the full SHA
    e5b8c12 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    70e3a1a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d4d5be3 View commit details
    Browse the repository at this point in the history
  9. get(s..=usize::MAX) should be fine when s != 0

    Test for coverage
    Philippe-Cholet committed May 14, 2024
    Configuration menu
    Copy the full SHA
    0ac556c View commit details
    Browse the repository at this point in the history
  10. Remove free function get

    A `use itertools::*;` might conflict with such a general function name.
    Philippe-Cholet committed May 14, 2024
    Configuration menu
    Copy the full SHA
    3f49188 View commit details
    Browse the repository at this point in the history