extern crate pct_str;
use pct_str::{InvalidPctString, PctStr, PctString};
fn main() -> Result<(), InvalidPctString<String>> {
let pct_string = PctString::from_string("Hello%20World%21".to_string())?;
assert!(pct_string == "Hello World!");
assert!(pct_string.as_str() == "Hello%20World%21");
assert!(
pct_string.as_pct_str()
== PctStr::new("Hello%20World%21").map_err(InvalidPctString::into_owned)?
);
for c in pct_string.chars() {
println!("{}", c);
}
let decoded_string: String = pct_string.decode();
println!("{}", decoded_string);
Ok(())
}