#uri #parser #break #component #structured #user-name #domain

bin+lib uri_parser_gdv

URI Parser is a pest-based parser that breaks URIs into structured components

6 releases

0.1.5 Nov 19, 2024
0.1.4 Nov 14, 2024

#882 in Authentication

Download history 294/week @ 2024-11-08 188/week @ 2024-11-15 19/week @ 2024-11-22 5/week @ 2024-11-29 4/week @ 2024-12-06

364 downloads per month

MIT license

10KB
185 lines

uri_parser_gdv

Crates.io: https://crates.io/crates/uri_parser_gdv/


URI Parser is a pest-based parser that breaks URIs into structured components

Parsing Logic

Parsing logic

The following components are supported:

  • Scheme
  • Authority: username and password
  • Domain / IPv4
  • Port
  • Path (segmented by /)
  • Query params
  • Subdomain: Optional subdomain that appears before the main domain.

Usage

Parsing URIs

uri_parser_gdv parse <URI>

Subcommands

  about          Print author's details

Args and opts

  -h, --help     Print help
  -V, --version  Print version

Example

uri_parser_gdv parse wss://user:pass@greedydev.io:1234/hello/world?msg=message&type=2

Output:

scheme: wss
authority:
  - username: user
  - password: pass
domain: greedydev.io
port: 1234
path: /hello/world
query:
  - msg: message
  - type: 2

Dependencies

~4MB
~71K SLoC