| lib.rs |
Compile-time URL validation macro for application-services.
Provides a [`url!`] proc macro that validates a string literal as a
parseable URL at compile time. Invalid input produces a compile
error pointing at the offending literal; valid input expands to a
runtime `url::Url::parse` call that is guaranteed to succeed.
## Consumer requirements
The expanded code references `::url::Url::parse`, so the calling
crate must declare `url` as a dependency.
## Limitations
`url::Url::parse` is not `const fn`, so the macro cannot be used
directly in `static`/`const` initializers. Wrap with
`once_cell::Lazy` or `std::sync::LazyLock` for static contexts. |
1926 |
- |