3 releases
0.1.4 | Oct 10, 2024 |
---|---|
0.1.3 | May 26, 2024 |
0.0.0 |
|
#485 in Encoding
5,655 downloads per month
23KB
530 lines
detrim
Deserialization trimming for strings in serde models.
Examples
#[derive(Debug, serde::Deserialize)]
struct Form {
#[serde(deserialize_with = "detrim::string")]
name: String,
}
let form = serde_json::from_str::<Form>(r#"{ "name": "ferris" }"#).unwrap();
assert_eq!(form.name, "ferris");
let form = serde_json::from_str::<Form>(r#"{ "name": " ferris " }"#).unwrap();
assert_eq!(form.name, "ferris");
Dependencies
~105–330KB