#uri #url #parser

pathetic

Relative URI library for Rust, based on the url crate

4 releases (2 breaking)

0.3.0 Mar 18, 2020
0.2.1 Mar 16, 2020
0.2.0 Mar 13, 2020
0.1.0 Mar 6, 2020

#989 in HTTP server

Download history 8/week @ 2024-03-11 50/week @ 2024-03-18 15/week @ 2024-04-01 22/week @ 2024-04-22 183/week @ 2024-05-13 99/week @ 2024-05-20 63/week @ 2024-06-03 159/week @ 2024-06-10 28/week @ 2024-06-17 8/week @ 2024-06-24

258 downloads per month

MIT license

10KB
158 lines

pathetic

Docs Crates.io

A library for working with relative URIs, based on the url crate.

Usage:

fn main() {
    let uri = pathetic::Uri::default()
        .with_path_segments_mut(|p| p.extend(&["foo", "bar"]))
        .with_query_pairs_mut(|q| q.append_pair("foo", "bar"))
        .with_fragment(Some("baz"));

    assert_eq!("/foo/bar?foo=bar#baz", uri.as_str());
}

Current version: 0.3.0

License: MIT


lib.rs:

A library for working with relative URIs, based on the url crate.

Usage:

fn main() {
    let uri = pathetic::Uri::default()
        .with_path_segments_mut(|p| p.extend(&["foo", "bar"]))
        .with_query_pairs_mut(|q| q.append_pair("foo", "bar"))
        .with_fragment(Some("baz"));

    assert_eq!("/foo/bar?foo=bar#baz", uri.as_str());
} 

Dependencies

~1–5.5MB
~132K SLoC