#uri #parser #query #string #incomplete

auris

A simple (incomplete) URI parser

4 releases

0.1.3 May 3, 2020
0.1.2 Apr 26, 2020
0.1.1 Apr 14, 2020
0.1.0 Apr 11, 2020

#22 in #incomplete

MIT license

16KB
313 lines

Auris, URI parser for Rust

crates.io

  • Uses only safe features in rust
  • Working towards rfc2396 & rfc3986 compliance

Parses structure:

    foo://example.com:8042/over/there?name=ferret#nose
    \_/   \______________/\_________/ \_________/ \__/
     |           |            |            |        |
  scheme     authority       path        query   fragment

Usage

use auris::URI;

"postgres://user:password@host".parse::<URI<String>>();

"https://crates.io/crates/auris".parse::<URI<String>>();

Query strings

We also parse query strings into HashMaps:

"postgres://user:password@example.com/db?replication=true".parse::<URI<String>>();

In the case of duplicated query string tags the last one wins:

"scheme://host/path?a=1&a=2".parse::<URI<String>>();

Documentation

Todo

  • Ports
  • Split up into multiple files
  • Domains with .
  • Rendering of URIs and Authority with fmt::Display
  • Net loc compliance
  • Parsing IPv4, IPv6
  • Parsing fragments
  • Percent encoding and decoding
  • QuickCheck?

Dependencies

~1MB
~18K SLoC