API Reference

url

URL parsing and manipulation for Rust following the WHATWG URL standard.

Official Documentation ↗
CompatibilityThis documentation covers version v2.5. Check the official docs for the latest API surface.

Installation

cargocargo add url

Methods

url parses absolute URLs, resolves relative references, and exposes components and query pairs.

Key Features

  • Strict WHATWG parsing
  • Relative URL resolution with join
  • Query pair editing and percent encoding

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://docs.rs/url/latest/url/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:53:16.811Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

Why does parse fail on a relative path?
Url::parse requires an absolute URL with a scheme. Use join on a base URL for relative references.
How do I percent-encode a value?
Use the form_urlencoded or percent-encoding crates together with query_pairs_mut for correct encoding.
Are non-special schemes accepted?
Yes. Custom schemes parse, though some normalization rules differ from http and https.