[][src]Crate urltemplate

URLTemplate

Utility that enables URLs with placeholders, i.e. `https://www.mozilla.org/?utm_source={source}&utm_medium={medium}

Usage

extern crate urltemplate;

use urltemplate::UrlTemplate;
use std::collections::HashMap;

let mut params = HashMap::new();
params.insert("source".to_string(), "url-template-crate-❤".to_string());
let url_with_placeholders = UrlTemplate::from("https://www.mozilla.org/?utm_source={source}");
let url =  url_with_placeholders.substitute_str(&params).expect("valid url");
assert_eq!(url, "https://www.mozilla.org/?utm_source=url-template-crate-❤")

Structs

UrlTemplate
UrlTemplateError

Enums

UrlTemplateErrorKind