URL Prefix
This crate can be used to create URL prefix strings by inputting a protocol, a domain, a port number and a path without additional parsing.
Why We Need This?
Sometimes our web applications are run on different protocols(HTTP/HTTPS) and domains. And it is boring to write some code like below to format a URL:
let mut url_prefix = String new;
if is_https else
url_prefix.push_str;
if is_https && port != 443 || !is_https && port != 80
Instead, we can easily use this crate to create URL prefix strings. For examples,
let prefix = create_prefix;
assert_eq!;
let prefix = create_prefix;
assert_eq!;
Crates.io
https://crates.io/crates/url-prefix