#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

#449 in Encoding

Download history 1928/week @ 2024-09-24 1561/week @ 2024-10-01 1544/week @ 2024-10-08 1705/week @ 2024-10-15 1526/week @ 2024-10-22 1553/week @ 2024-10-29 1325/week @ 2024-11-05 881/week @ 2024-11-12 2048/week @ 2024-11-19 1344/week @ 2024-11-26 1265/week @ 2024-12-03 1208/week @ 2024-12-10 1224/week @ 2024-12-17 137/week @ 2024-12-24 1019/week @ 2024-12-31 1633/week @ 2025-01-07

4,234 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

~100–325KB