Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Path has method child for adding a single segment to the path. It clones the inner String but doesn't take ownership of the Path. This ends up cloning unnecessarily if the original Path will be dropped.
Describe the solution you'd like
impl Path {
fn join(self, child: impl Into<PathPart<'_>>) -> Self;
}
Describe alternatives you've considered
Bikeshedding: what should be done with the existing Path::child?
One option is to change it directly instead of adding a new method. This would be a breaking change of course.
Another option is to deprecate child, replace its implementation with .clone().join(), and recommend that users inline it immediately.
Yet another option is to keep both methods. Less API churn, but larger API surface long-term.
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Pathhas methodchildfor adding a single segment to the path. It clones the innerStringbut doesn't take ownership of thePath. This ends up cloning unnecessarily if the originalPathwill be dropped.Describe the solution you'd like
Describe alternatives you've considered
Bikeshedding: what should be done with the existing
Path::child?One option is to change it directly instead of adding a new method. This would be a breaking change of course.
Another option is to deprecate
child, replace its implementation with.clone().join(), and recommend that users inline it immediately.Yet another option is to keep both methods. Less API churn, but larger API surface long-term.