#url-validation #compile-time #macro #url

macro url-macro

A compile-time URL validation macro. Parses and checks URLs at compile-time, converting valid URLs into url::Url objects. Provides early error detection for malformed URLs.

18 releases

0.2.3 Dec 30, 2025
0.2.2 Dec 28, 2025
0.2.0 Mar 30, 2025
0.1.13 Feb 22, 2025
0.1.7 Jul 31, 2024

#289 in Procedural macros

Download history 202/week @ 2025-12-27 1613/week @ 2026-01-03 2298/week @ 2026-01-10 1914/week @ 2026-01-17 1057/week @ 2026-01-24 1154/week @ 2026-01-31 2363/week @ 2026-02-07 2425/week @ 2026-02-14 2723/week @ 2026-02-21 4172/week @ 2026-02-28 3295/week @ 2026-03-07 2836/week @ 2026-03-14 2405/week @ 2026-03-21 2557/week @ 2026-03-28 1949/week @ 2026-04-04 1882/week @ 2026-04-11

9,056 downloads per month
Used in 9 crates (5 directly)

Apache-2.0 OR MIT

12KB
75 lines

Compile-time URL validation

Build Documentation

This crate provides a url! macro for compile-time URL validation.

Examples

// This compiles correctly
let valid = url!("https://www.rust-lang.org/");
// This triggers a compiler error
let invalid = url!("foo");

Installation

cargo add url-macro url

Gratitude

Like the project? ⭐ Star this repo on GitHub!

License

Apache-2.0 or MIT.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, shall be licensed as above, without any additional terms or conditions.

Dependencies

~2–3MB
~51K SLoC