Add Deserializer::from_bytes
.
Fix deserialization of optional sequences of a single non-string element.
Add push_to_string
for serializing a struct to the end of an existing String
buffer (instead of allocating a fresh one for the serialized output).
Fix deserialization of optional sequences of a single element.
Improve README and crate documentation (now the exact same, instead of just a single-line description).
This release only upgrades one of the crates' dev-dependencies.
This release only upgrades one of the crates' private dependencies.
Support deserialization of sequences with duplicate keys. This used to fail, but passes now:
let result = vec![("foo".to_owned(), 1), ("bar".to_owned(), 2), ("foo".to_owned(), 3)];
assert_eq!(super::from_str("foo=1&bar=2&foo=3"), Ok(result));
This should mainly affect deserialization to a type that's explicitly a sequence, like arrays or Vec
,
but some other things were changed too so if you are getting unexpected deserialization errors, please open an issue.
This release has a minimum Rust version of 1.56.
Support deserialization of Option
al values to better support forms with optional inputs of non-string types:
#[derive(Deserialize, PartialEq)]
struct MyForm {
field: Option<u16>,
}
// What browsers send when a value is given
assert_eq!(serde_html_form::from_str("field=5").unwrap(), MyForm { field: Some(5) });
// What browsers send when no value is given
assert_eq!(serde_html_form::from_str("field=").unwrap(), MyForm { field: None });
// This also works
assert_eq!(serde_html_form::from_str("").unwrap(), MyForm { field: None });
Initial release.