join_path
Joins two pieces of a URL or path with exactly one / between them.
Trailing slashes of base and leading slashes of segment are trimmed first, so
"a/" + "/b", "a" + "b" and "a//" + "b" all give "a/b". Nothing is encoded or
resolved: use Url::join to resolve a reference against a base URL, and
percent_encode for a segment that may contain reserved characters.
Import
Section titled “Import”Cargo feature url (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
base | &str | The first part, such as "https://api.example.com/v1/". |
segment | &str | The part to append, such as "/users". |
Returns
Section titled “Returns”String — The two parts joined by a single /.
