| Crates.io | compact-calendar |
| lib.rs | compact-calendar |
| version | 1.1.3 |
| created_at | 2022-08-12 12:13:14.275682+00 |
| updated_at | 2025-05-30 08:38:26.992309+00 |
| description | Compact representation of a set of days based on a bit-maps |
| homepage | https://github.com/remi-dupre/opening-hours-rs/tree/master/compact-calendar |
| repository | https://github.com/remi-dupre/opening-hours-rs |
| max_upload_size | |
| id | 643964 |
| size | 28,481 |
This modules basically builds a data-structure for a set of days based on bit-maps. This is built to store a collection of regional holidays for the opening-hours crate.
Here is how serialized data is represented:
start size year 1 year 2 ...
┌──────┬──────┬───────────────┬───────────────┬────
│ 8B │ 8B │ 8B * 12 = 96B │ 8B * 12 = 96B │ ...
└──────┴──────┴───────────────┴───────────────┴────
Each year is just an array of 12 u32 where the least significant bits each
represent a day.
While a bitset might not be the most efficient way to store a collection of dates for sparse data, this approached proved to be very compact when combined with a Zlib encoder. This methods allowed to store all holidays from 2000 to 2100 as described by workalendar in only 60kb of data.