diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9511c25..d03687b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -45,6 +45,8 @@ jobs: run: cargo run --example deserialize_duration - name: Run examples with deserialize_duration_chrono run: cargo run --example deserialize_duration_chrono + - name: Run examples with deserialize_duration_time + run: cargo run --example deserialize_duration_time # build on nightly - uses: actions-rs/toolchain@v1 @@ -64,4 +66,4 @@ jobs: - name: Publish shell: bash run: | - cargo publish --token ${{ secrets.CRATES_GITHUB_TOKEN }} \ No newline at end of file + cargo publish --token ${{ secrets.CRATES_GITHUB_TOKEN }} diff --git a/src/serde.rs b/src/serde.rs index fd482ed..628bd7a 100644 --- a/src/serde.rs +++ b/src/serde.rs @@ -1,4 +1,8 @@ -use crate::{parse_chrono, parse_std, parse_time}; +#[cfg(all(feature = "chrono", feature = "serde"))] +use crate::parse_chrono; +use crate::parse_std; +#[cfg(all(feature = "time", feature = "serde"))] +use crate::parse_time; use std::time::Duration; #[cfg(all(feature = "chrono", feature = "serde"))] @@ -160,7 +164,7 @@ mod tests { ); } - #[cfg(feature = "serde")] + #[cfg(all(feature = "serde", feature = "chrono"))] #[test] fn test_deserialize_duration_chrono() { use chrono::Duration; @@ -177,7 +181,7 @@ mod tests { ); } - #[cfg(feature = "serde")] + #[cfg(all(feature = "serde", feature = "chrono"))] #[test] fn test_deserialize_option_duration_chrono() { use chrono::Duration;