#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

#464 in Encoding

Download history 92/week @ 2024-07-02 32/week @ 2024-07-09 122/week @ 2024-07-23 150/week @ 2024-07-30 489/week @ 2024-08-06 1125/week @ 2024-08-13 1209/week @ 2024-08-20 1159/week @ 2024-08-27 1193/week @ 2024-09-03 1008/week @ 2024-09-10 1086/week @ 2024-09-17 1928/week @ 2024-09-24 1561/week @ 2024-10-01 1544/week @ 2024-10-08 1676/week @ 2024-10-15

6,938 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

~110–335KB