Crates.io | ada-url |
lib.rs | ada-url |
version | |
source | src |
created_at | 2023-05-10 13:25:54.336359 |
updated_at | 2024-12-03 20:33:25.466221 |
description | Fast WHATWG Compliant URL parser |
homepage | https://ada-url.com |
repository | https://github.com/ada-url/rust |
max_upload_size | |
id | 861340 |
Cargo.toml error: | TOML parse error at line 23, column 1 | 23 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Fast WHATWG URL Specification compliant URL parser for Rust. Well-tested and widely used by Node.js since Node 18.
The Ada library passes the full range of tests from the specification, across a wide range of platforms (e.g., Windows, Linux, macOS). It fully supports the relevant Unicode Technical Standard.
See here for a usage example.
You can run it locally with cargo run --example simple
.
Feel free to adjust it for exploring this crate further.
std: Functionalities that require std
.
This feature is enabled by default, set no-default-features
to true
if you want no-std
.
serde: Allow Url
to work with serde
. This feature is disabled by default. Enabling this feature without std
would provide you only Serialize
.
Enabling this feature and std
would provide you both Serialize
and Deserialize
.
libcpp: Build ada-url
with libc++
. This feature is disabled by default.
Enabling this feature without libc++
installed would cause compile error.
Ada is fast. The benchmark below shows 3.49 times faster URL parsing compared to url
can_parse/ada_url time: [1.2109 µs 1.2121 µs 1.2133 µs]
thrpt: [635.09 MiB/s 635.75 MiB/s 636.38 MiB/s]
parse/ada_url time: [2.0124 µs 2.0157 µs 2.0190 µs]
thrpt: [381.67 MiB/s 382.28 MiB/s 382.91 MiB/s]
parse/url time: [7.0530 µs 7.0597 µs 7.0666 µs]
thrpt: [109.04 MiB/s 109.15 MiB/s 109.25 MiB/s]
Url
implements the following traits.
Trait(s) | Description |
---|---|
Display |
Provides to_string and allows for the value to be used in format! macros (e.g. println! ). |
Debug |
Allows debugger output in format macros, ({:?} syntax) |
PartialEq , Eq |
Allows for comparison, url1 == url2 , url1.eq(url2) |
PartialOrd , Ord |
Allows for ordering url1 < url2 , done so alphabetically. This is also allows Url to be used as a key in a BTreeMap |
Hash |
Makes it so that Url can be hashed based on the string representation. This is important so that Url can be used as a key in a HashMap |
FromStr |
Allows for use with str 's parse method |
TryFrom<String> , TryFrom<&str> |
Provides try_into methods for String and &str |
Borrow<str> , Borrow<[u8]> |
Used in some crates so that the Url can be used as a key. |
Deref<Target=str> |
Allows for &Url to dereference as a &str . Also provides a number of string methods |
AsRef<[u8]> , AsRef<str> |
Used to do a cheap reference-to-reference conversion. |
Send |
Used to declare that the type can be transferred across thread boundaries. |
Sync |
Used to declare that the type is thread-safe. |
justfile
The justfile
contains commands (called "recipes") that can be executed by just for convenience.
Run all lints and tests:
just all
Skipping features:
just all --skip=libcpp,serde
This code is made available under the Apache License 2.0 as well as the MIT license.
Our tests include third-party code and data. The benchmarking code includes third-party code: it is provided for research purposes only and not part of the library.