fluent-uri
A generic URI parser in Rust that strictly adheres to IETF RFC 3986.
- Fast: Zero-copy parsing. Observed to be 2x ~ 25x faster than common URI parsers in Rust.
- Easy: Carefully designed and documented APIs. Handy percent-encoding utilities.
- Strict: Parses every possible URI defined in the RFC and denies anything else.
Features & Examples
-
EStr
(Percent-encoded string slices):All components in a URI that may be percent-encoded are parsed as
EStr
s, which allows easy splitting and fast decoding:let query = "name=%E5%BC%A0%E4%B8%89&speech=%C2%A1Ol%C3%A9!"; let map: = new .split .filter_map .map .filter_map .collect; assert_eq!; assert_eq!;
-
Three variants of
Uri
for different use cases:Uri<&str>
: borrowed; immutable.Uri<&mut [u8]>
: borrowed; in-place mutable.Uri<String>
: owned; immutable.
Decode and extract query parameters in-place from a URI reference:
let mut bytes = *b"?lang=Rust&mascot=Ferris%20the%20crab"; let = decode_and_extract_query?; assert_eq!; assert_eq!; // The query is taken from the `Uri`. assert!; // In-place decoding is like this if you're interested: assert_eq!;
Roadmap
- URI building.
- Reference resolution.
- Normalization and comparison.
- Host: IDNA encoding and DNS syntax checking.