servo / servo/rust-url

PathSegmentsMut has no finish method like UrlQuery

Open
#363 6 comments 1 reaction 1 assignee View on GitHub

@nox is already working on this.

Since Jul 18, 2019.

enhancement
Dominant language
Rust
Stars
1.6k
Forks
406
PR merge metrics
No merged PRs in 30d

Description

When building a URL, it would be convenient to be able to finish mutating path segments like one currently can for query pairs.

// will NOT compile
let mut url = Url::parse("...");
url
    .path_segments_mut().unwrap()
        // ...
    .query_pairs_mut()
        // ...
        .finish()
    // ...

Instead the query pairs must be mutated first, since this 'sub builder' can be finished, returning a Url. Which (though slightly counter-intuitive) is fine, it's just a slightly jarring restriction.

It also means the mutable variable is necessary; if it behaved like query_pairs_mut then this could all be on one chain which could be passed directly (or via an immutable variable) into a Client method.

From https://github.com/seanmonstar/reqwest/issues/150
/cc @OJFord

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.