Skip to content

PathSegmentsMut has no finish method like UrlQuery #363

Open
@seanmonstar

Description

@seanmonstar

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 seanmonstar/reqwest#150
/cc @OJFord

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions