3 releases
0.1.4 | Oct 10, 2024 |
---|---|
0.1.3 | May 26, 2024 |
0.0.0 |
|
#464 in Encoding
6,938 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
~110–335KB