1extern crate pct_str;
2
3use pct_str::{InvalidPctString, PctStr, PctString};
4
5fn main() -> Result<(), InvalidPctString<String>> {
6 let pct_string = PctString::from_string("Hello%20World%21".to_string())?;
10
11 assert!(pct_string == "Hello World!");
13
14 assert!(pct_string.as_str() == "Hello%20World%21");
16
17 assert!(
19 pct_string.as_pct_str()
20 == PctStr::new("Hello%20World%21").map_err(InvalidPctString::into_owned)?
21 );
22
23 for c in pct_string.chars() {
26 println!("{}", c);
27 }
28
29 let decoded_string: String = pct_string.decode();
32 println!("{}", decoded_string);
33
34 Ok(())
35}