Skip to content

Commit c02665b

Browse files
authored
Remove lifetime from Encoding and Utf8Encoding traits (#47)
* Remove lifetime parameter from `Encoding` and `Utf8Encoding` traits * Bump minimum Rust version from `1.58.1` -> `1.65.0`, which supports GATs
1 parent 300a590 commit c02665b

25 files changed

Lines changed: 251 additions & 251 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ jobs:
6969
- { rust: stable, os: ubuntu-latest, flags: "--no-default-features" }
7070
- { rust: stable, os: ubuntu-latest, target: wasm32-unknown-unknown, flags: "--all-features" }
7171
- { rust: stable, os: ubuntu-latest, target: wasm32-unknown-unknown, flags: "--no-default-features" }
72-
- { rust: 1.58.1, os: ubuntu-latest, flags: "--all-features" }
73-
- { rust: 1.58.1, os: ubuntu-latest, flags: "--no-default-features" }
72+
- { rust: 1.65.0, os: ubuntu-latest, flags: "--all-features" }
73+
- { rust: 1.65.0, os: ubuntu-latest, flags: "--no-default-features" }
7474
steps:
7575
- uses: actions/checkout@v2
7676
- name: Install Rust ${{ matrix.rust }} ${{ matrix.target }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "typed-path"
33
description = "Provides typed variants of Path and PathBuf for Unix and Windows"
44
version = "0.10.0"
55
edition = "2021"
6-
rust-version = "1.58.1"
6+
rust-version = "1.65.0"
77
authors = ["Chip Senkbeil <chip@senkbeil.org>"]
88
categories = ["development-tools", "filesystem", "os"]
99
keywords = ["unicode", "utf8", "paths", "filesystem"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
[doc_lnk]: https://docs.rs/typed-path
99
[ci_img]: https://github.com/chipsenkbeil/typed-path/actions/workflows/ci.yml/badge.svg
1010
[ci_lnk]: https://github.com/chipsenkbeil/typed-path/actions/workflows/ci.yml
11-
[rustc_img]: https://img.shields.io/badge/rustc_1.58.1+-lightgray.svg
12-
[rustc_lnk]: https://blog.rust-lang.org/2022/01/20/Rust-1.58.1.html
11+
[rustc_img]: https://img.shields.io/badge/rustc_1.65.0+-lightgray.svg
12+
[rustc_lnk]: https://blog.rust-lang.org/2022/11/03/Rust-1.65.0/
1313

1414
Provides typed variants of [`Path`][StdPath] and [`PathBuf`][StdPathBuf] for
1515
Unix and Windows.

src/common/non_utf8.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ use crate::no_std_compat::*;
1919
use crate::private;
2020

2121
/// Interface to provide meaning to a byte slice such that paths can be derived
22-
pub trait Encoding<'a>: private::Sealed {
22+
pub trait Encoding: private::Sealed {
2323
/// Represents the type of component that will be derived by this encoding
24-
type Components: Components<'a>;
24+
type Components<'a>: Components<'a>;
2525

2626
/// Static label representing encoding type
2727
fn label() -> &'static str;
2828

2929
/// Produces an iterator of [`Component`]s over the given the byte slice (`path`)
30-
fn components(path: &'a [u8]) -> Self::Components;
30+
fn components(path: &[u8]) -> Self::Components<'_>;
3131

3232
/// Hashes a byte slice (`path`)
3333
fn hash<H: Hasher>(path: &[u8], h: &mut H);

src/common/non_utf8/iter.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ use crate::{Component, Components, Encoding, Path};
1313
#[derive(Clone)]
1414
pub struct Iter<'a, T>
1515
where
16-
T: Encoding<'a>,
16+
T: Encoding,
1717
{
1818
_encoding: PhantomData<T>,
19-
inner: <T as Encoding<'a>>::Components,
19+
inner: <T as Encoding>::Components<'a>,
2020
}
2121

2222
impl<'a, T> Iter<'a, T>
2323
where
24-
T: for<'enc> Encoding<'enc> + 'a,
24+
T: Encoding,
2525
{
26-
pub(crate) fn new(inner: <T as Encoding<'a>>::Components) -> Self {
26+
pub(crate) fn new(inner: <T as Encoding>::Components<'a>) -> Self {
2727
Self {
2828
_encoding: PhantomData,
2929
inner,
@@ -51,16 +51,16 @@ where
5151

5252
impl<'a, T> fmt::Debug for Iter<'a, T>
5353
where
54-
T: for<'enc> Encoding<'enc> + 'a,
54+
T: for<'enc> Encoding + 'a,
5555
{
5656
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5757
struct DebugHelper<'a, T>(&'a Path<T>)
5858
where
59-
T: for<'enc> Encoding<'enc>;
59+
T: for<'enc> Encoding;
6060

6161
impl<T> fmt::Debug for DebugHelper<'_, T>
6262
where
63-
T: for<'enc> Encoding<'enc>,
63+
T: for<'enc> Encoding,
6464
{
6565
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6666
f.debug_list().entries(self.0.iter()).finish()
@@ -75,7 +75,7 @@ where
7575

7676
impl<'a, T> AsRef<Path<T>> for Iter<'a, T>
7777
where
78-
T: for<'enc> Encoding<'enc> + 'a,
78+
T: for<'enc> Encoding + 'a,
7979
{
8080
#[inline]
8181
fn as_ref(&self) -> &Path<T> {
@@ -85,7 +85,7 @@ where
8585

8686
impl<'a, T> AsRef<[u8]> for Iter<'a, T>
8787
where
88-
T: for<'enc> Encoding<'enc> + 'a,
88+
T: for<'enc> Encoding + 'a,
8989
{
9090
#[inline]
9191
fn as_ref(&self) -> &[u8] {
@@ -95,7 +95,7 @@ where
9595

9696
impl<'a, T> Iterator for Iter<'a, T>
9797
where
98-
T: for<'enc> Encoding<'enc> + 'a,
98+
T: for<'enc> Encoding + 'a,
9999
{
100100
type Item = &'a [u8];
101101

@@ -110,7 +110,7 @@ where
110110

111111
impl<'a, T> DoubleEndedIterator for Iter<'a, T>
112112
where
113-
T: for<'enc> Encoding<'enc> + 'a,
113+
T: for<'enc> Encoding + 'a,
114114
{
115115
#[inline]
116116
fn next_back(&mut self) -> Option<Self::Item> {
@@ -121,7 +121,7 @@ where
121121
}
122122
}
123123

124-
impl<'a, T> FusedIterator for Iter<'a, T> where T: for<'enc> Encoding<'enc> + 'a {}
124+
impl<'a, T> FusedIterator for Iter<'a, T> where T: for<'enc> Encoding + 'a {}
125125

126126
/// An iterator over [`Path`] and its ancestors.
127127
///
@@ -145,14 +145,14 @@ impl<'a, T> FusedIterator for Iter<'a, T> where T: for<'enc> Encoding<'enc> + 'a
145145
#[derive(Copy, Clone, Debug)]
146146
pub struct Ancestors<'a, T>
147147
where
148-
T: for<'enc> Encoding<'enc>,
148+
T: for<'enc> Encoding,
149149
{
150150
pub(crate) next: Option<&'a Path<T>>,
151151
}
152152

153153
impl<'a, T> Iterator for Ancestors<'a, T>
154154
where
155-
T: for<'enc> Encoding<'enc>,
155+
T: for<'enc> Encoding,
156156
{
157157
type Item = &'a Path<T>;
158158

@@ -164,4 +164,4 @@ where
164164
}
165165
}
166166

167-
impl<T> FusedIterator for Ancestors<'_, T> where T: for<'enc> Encoding<'enc> {}
167+
impl<T> FusedIterator for Ancestors<'_, T> where T: for<'enc> Encoding {}

0 commit comments

Comments
 (0)