#deserialize #serde #utilities

no-std detrim

Automatic string trimming with serde

3 releases

0.1.4 Oct 10, 2024
0.1.3 May 26, 2024
0.0.0 May 19, 2024

#429 in Encoding

Download history 1555/week @ 2024-09-20 1861/week @ 2024-09-27 1534/week @ 2024-10-04 1439/week @ 2024-10-11 1800/week @ 2024-10-18 1626/week @ 2024-10-25 1515/week @ 2024-11-01 671/week @ 2024-11-08 2023/week @ 2024-11-15 1331/week @ 2024-11-22 1356/week @ 2024-11-29 1329/week @ 2024-12-06 1266/week @ 2024-12-13 380/week @ 2024-12-20 420/week @ 2024-12-27 1502/week @ 2025-01-03

3,793 downloads per month

MIT/Apache

23KB
530 lines

detrim

crates.io Documentation dependency status MIT or Apache 2.0 licensed
CI codecov Version Download

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

~90–315KB