Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CFGs #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
mod types;
pub use types::*;

#[cfg(not(docs_rs))]
#[cfg(not(docsrs))]
use std::{collections::BTreeMap, io::Read};

#[cfg(not(docs_rs))]
#[cfg(not(docsrs))]
type CountryHolidayMap =
BTreeMap<types::CountryCode, BTreeMap<types::SubDivision, BTreeMap<chrono::NaiveDate, String>>>;

#[cfg(not(docs_rs))]
#[cfg(not(docsrs))]
const HOLIDAYS: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/holidays"));

#[cfg(not(docs_rs))]
#[cfg(not(docsrs))]
pub fn initialise() -> Result<CountryHolidayMap, String> {
let mut d = flate2::read::DeflateDecoder::new(HOLIDAYS);
let mut out = Vec::new();
Expand All @@ -20,10 +20,10 @@ pub fn initialise() -> Result<CountryHolidayMap, String> {
ron::de::from_bytes(&out).map_err(|e| format!("{e:?}"))
}

#[cfg(all(feature = "years", not(target_arch = "wasm_32")))]
#[cfg(all(feature = "years", not(target_arch = "wasm32")))]
pub use years::*;

#[cfg(all(feature = "years", not(target_arch = "wasm_32")))]
#[cfg(all(feature = "years", not(target_arch = "wasm32")))]
mod years {
use std::{io::Write, process::Stdio};

Expand Down Expand Up @@ -61,7 +61,7 @@ mod years {
}

#[cfg(test)]
#[cfg(not(docs_rs))]
#[cfg(not(docsrs))]
mod tests {
use super::*;

Expand All @@ -71,7 +71,7 @@ mod tests {
}

#[test]
#[cfg(all(feature = "years", not(target_arch = "wasm_32")))]
#[cfg(all(feature = "years", not(target_arch = "wasm32")))]
fn test_generate_with_years() {
assert!(generate_with_years(Vec::from([2023])).is_ok());
}
Expand Down