Skip to content

Conversation

@Kinrany
Copy link
Contributor

@Kinrany Kinrany commented Nov 11, 2025

Which issue does this PR close?

Closes #545

Rationale for this change

fn prefix(&self) was the first thing I really wanted to have on Path, as opposed to copying from project to project.

It also benefits from direct access to raw. In userland we have to use paths and collect, and omitting the last item is not trivial.

What changes are included in this PR?

Implementations of everything listed with minimal docs, without tests.

Are there any user-facing changes?

Most of these changes are user-facing.

Internal changes:

  • impl FromIterator delegates most of the logic to impl Expand
  • Path::parts now returns a custom iterator type
  • Added DELIMITER_CHAR

There should be no breaking changes.

@Kinrany
Copy link
Contributor Author

Kinrany commented Nov 11, 2025

Draft for now: everything should work but I'd like to know which of these changes would be welcome, if any. Thanks for maintaining this by the way 🙂

@Kinrany
Copy link
Contributor Author

Kinrany commented Nov 11, 2025

One alternative I'm considering is a fn prefix that takes ownership and avoids cloning. The caller can always clone the original path first if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Path ergonomics

1 participant