Skip to content

Mutate segments throught PathSegmentsMut #383

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

Open
antoyo opened this issue Jul 24, 2017 · 2 comments
Open

Mutate segments throught PathSegmentsMut #383

antoyo opened this issue Jul 24, 2017 · 2 comments

Comments

@antoyo
Copy link

antoyo commented Jul 24, 2017

Hello.
It would be nice to be able to update a segment from PathSegmentsMut (or throught another way).
My use case is to iterate over the segments of a URL and increment one number found in a segment.
(Ideally, I'd like to be able to do the same with query parameters, so I'd like to have this same API for Serializer).
Thanks.

@SimonSapin
Copy link
Member

String::replace_range was added recently and would allow doing this somewhat efficiently. What would you imagine the API would look like? What the segment to replace be identified by a usize index?

@antoyo
Copy link
Author

antoyo commented Oct 30, 2019

Yeah, having a function taking the index of the segment to replace would be perfect.
It would be nice to have the same kind of API for Serializer.

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

No branches or pull requests

3 participants