Crates.io | weekdays |
lib.rs | weekdays |
version | 0.1.0 |
source | src |
created_at | 2024-11-09 12:08:20.937843 |
updated_at | 2024-11-09 12:08:20.937843 |
description | Days of the week bit-mapped in a single byte |
homepage | |
repository | https://github.com/danwilliams/weekdays |
max_upload_size | |
id | 1442004 |
size | 49,432 |
The Weekdays crate provides a simple Weekdays
type for representing days of the week bit-mapped in a single byte, and
functionality for working with them.
This is particularly useful when representing a set of days in a database field or similar.
Each bit represents a day of the week. The bits are ordered from most significant to least significant, starting from Monday, with the least significant bit representing Sunday.
Monday
| Tuesday
| | Wednesday
| | | Thursday
| | | | Friday
| | | | | Saturday
| | | | | | Sunday
1 1 1 1 1 1 1
The following feature flags are available:
chrono
: Enables conversion to and from the Weekday
type from the Chrono crate.postgres
: Implements the ToSql
and FromSql
traits for use with tokio-postgres.serde
: Enables serialisation and deserialisation with Serde
by implementing the Serialize
and Deserialize
traits.Additionally:
default
: Has no features enabled.
full
: Enables all features.
When using the postgres
feature, the expectation is that the database field
will be configured as BITS(7)
, i.e. a 7-bit bitfield.