Skip to content

Rust type for days of the week bit-mapped in a single byte

License

Notifications You must be signed in to change notification settings

danwilliams/weekdays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weekdays

Rust Crate version CI Docs License

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.

Bit layout

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

Feature flags

The following feature flags are available:

Additionally:

  • default: Has no features enabled.
  • full: Enables all features.

Database schema

When using the postgres feature, the expectation is that the database field will be configured as BITS(7), i.e. a 7-bit bitfield.

About

Rust type for days of the week bit-mapped in a single byte

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages