4 releases

Uses new Rust 2021

0.1.3 Oct 28, 2022
0.1.2 Aug 4, 2022
0.1.1 May 10, 2022
0.1.0 Jan 31, 2022

#39 in #cldr

Download history 39/week @ 2022-10-08 66/week @ 2022-10-15 150/week @ 2022-10-22 61/week @ 2022-10-29 61/week @ 2022-11-05 45/week @ 2022-11-12 79/week @ 2022-11-19 70/week @ 2022-11-26 43/week @ 2022-12-03 85/week @ 2022-12-10 57/week @ 2022-12-17 88/week @ 2022-12-24 44/week @ 2022-12-31 107/week @ 2023-01-07 110/week @ 2023-01-14 329/week @ 2023-01-21

601 downloads per month
Used in 5 crates (via icu_list)

Unicode-DFS-2016

13KB
222 lines

deduplicating_array crates.io

A serde serialization strategy that uses PartialEq to reduce serialized size.

This create can be used with Serde derive like this:


#[derive(serde::Deserialize, serde::Serialize)]
pub struct Foo {
    #[serde(with = "deduplicating_array")]
    data: [Bar; 12],
    // ...
}

Bars that are equal to a Bars that appears earlier in the array will not be serialized (instead, the index of the first occurence is serialized). Deserialization clones the first Bar into all the indices where it occurs (hence Bar has to implement Clone).

Human readable serialization represents skipped values as singleton arrays containing the target index, e.g. the Rust array ["Foo", "Bar", "Foo"] will serialize to JSON ["Foo", "Bar", [0]].

This implies that singleton integer arrays cannot be used as array elements (they do work in Bincode, but there's really not much point in using them).

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.

Dependencies

~0.3–0.9MB
~20K SLoC