pub fn from_str<'de, T: Deserialize<'de>>(input: &'de str) -> Result<T, Error>
Expand description
Deserializes a querystring from a &str
.
#[derive(Debug, Deserialize, PartialEq, Serialize)]
struct Query {
name: String,
age: u8,
occupation: String,
}
let q = Query {
name: "Alice".to_owned(),
age: 24,
occupation: "Student".to_owned(),
};
assert_eq!(
serde_qs::from_str::<Query>("name=Alice&age=24&occupation=Student").unwrap(),
q);