Skip to content

Commit

Permalink
Merge pull request #106 from cuviper/nth_back
Browse files Browse the repository at this point in the history
Specialize `nth_back` (MSRV 1.37)
  • Loading branch information
cuviper authored May 16, 2024
2 parents 864eae4 + a4382cb commit 1cea51a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
rust:
- 1.36.0 # MSRV
- 1.37.0 # MSRV
- stable
- beta
- nightly
Expand All @@ -38,7 +38,7 @@ jobs:
toolchain: ${{ matrix.rust }}

- name: MSRV dependencies
if: matrix.rust == '1.36.0'
if: matrix.rust == '1.37.0'
run: |
cargo generate-lockfile
cargo update -p serde_json --precise 1.0.99
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "either"
version = "1.11.0"
version = "1.12.0"
authors = ["bluss"]
edition = "2018"
rust-version = "1.36"
rust-version = "1.37"

license = "MIT OR Apache-2.0"
repository = "https://github.com/rayon-rs/either"
Expand Down
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@ __ https://docs.rs/either/
How to use with cargo::

[dependencies]
either = "1.11"
either = "1.12"


Recent Changes
--------------

- 1.12.0

- **MSRV**: ``either`` now requires Rust 1.37 or later.

- Specialize ``nth_back`` for ``Either`` and ``IterEither``, by @cuviper (#106)

- 1.11.0

- Add new trait ``IntoEither`` that is useful to convert to ``Either`` in method chains,
Expand Down
14 changes: 6 additions & 8 deletions src/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ where
for_both!(*self, ref mut inner => inner.next_back())
}

// TODO(MSRV): This was stabilized in Rust 1.37
// fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
// for_both!(*self, ref mut inner => inner.nth_back(n))
// }
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
for_both!(*self, ref mut inner => inner.nth_back(n))
}

fn rfold<Acc, G>(self, init: Acc, f: G) -> Acc
where
Expand Down Expand Up @@ -279,10 +278,9 @@ where
Some(map_either!(self.inner, ref mut inner => inner.next_back()?))
}

// TODO(MSRV): This was stabilized in Rust 1.37
// fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
// Some(map_either!(self.inner, ref mut inner => inner.nth_back(n)?))
// }
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
Some(map_either!(self.inner, ref mut inner => inner.nth_back(n)?))
}

fn rfold<Acc, G>(self, init: Acc, f: G) -> Acc
where
Expand Down

0 comments on commit 1cea51a

Please sign in to comment.