Function serde_urlencoded::de::from_bytes [] [src]

pub fn from_bytes<T: Deserialize>(input: &[u8]) -> Result<T, Error>

Deserializes a application/x-wwww-url-encoded value from a &[u8].

let meal = vec![
    ("bread".to_owned(), "baguette".to_owned()),
    ("cheese".to_owned(), "comté".to_owned()),
    ("meat".to_owned(), "ham".to_owned()),
    ("fat".to_owned(), "butter".to_owned()),
];

assert_eq!(
    serde_urlencoded::from_bytes::<Vec<(String, String)>>(
        b"bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter"),
    Ok(meal));