Crate early

Source
Expand description

This library aims to enable easy creation of families of URLs. For example many APIs needs one to access URLs, where the host name, port number, part of the path and possibly some part of the query string is the same, but the last part of the path differs. An example:

use early::Early;
let base = Early::new("https", "example.com")
    .path("api")
    .query("api-version", "42")
    .port(8080);
let people_url = base.clone().path("people").build();
let machines_url = base.path("machines").build();
assert_eq!(people_url, "https://example.com:8080/api/people?api-version=42");
assert_eq!(machines_url, "https://example.com:8080/api/machines?api-version=42");

Structsยง