Skip to content

a FromSegments that works in the middle of the path #511

@jjl

Description

@jjl

Yes, I know why this isn't as straightforward as it first appears.

  1. Why you believe this feature is necessary.

Strictly it's not necessary, but it would be rather nice since a lot of APIs in the wild go mad on how they use urls and it would make porting them to rust much easier.

  1. A convincing use-case for this feature.

Implementing e.g. the docker registry HTTP API which permits an arbitrary number of segments in the middle of the path to name the repository. Here are some examples:

/v2/foo/manifests/<ref>  => foo
/v2/foo/bar/manifests/<ref> => foo/bar
/v2/foo/bar/baz/manifests/<ref> => foo/bar/baz
  1. Why this feature can't or shouldn't exist outside of Rocket.

It could, but since it's useful for implementing a variety of in-the-wild apis compatibly, it would be nice to have it in core to allow people to just quickly port them. Doing it currently is ugly in the extreme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedAn accepted request or suggestionrequestRequest for new functionality

    Type

    No type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions