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

Switch from chrono to time #61

Merged
merged 4 commits into from
Oct 30, 2021
Merged
Show file tree
Hide file tree
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
21 changes: 15 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: test

on: [push, pull_request]

env:
# Minimum supported Rust version.
# Please also change README.md if you change this.
MSRV: 1.36.0

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -12,9 +17,7 @@ jobs:
- stable
- beta
- nightly
# Minimum supported Rust version.
# Please also change README.md if you change this.
- 1.36.0
- msrv

env:
RUSTFLAGS: -D warnings
Expand All @@ -23,14 +26,20 @@ jobs:
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
toolchain: ${{ matrix.rust == 'msrv' && env.MSRV || matrix.rust }}
override: true
- name: Test
run: |
cargo build --verbose
cargo test --verbose --no-default-features
cargo test --verbose --no-default-features --features="num-bigint bit-vec chrono std"
cargo doc --features="num-bigint bit-vec chrono"

# don't test features on MSRV
if [[ '${{ matrix.rust }}' != 'msrv' ]]; then
cargo test --verbose --no-default-features --features="num-bigint bit-vec time std"
cargo doc --features="num-bigint bit-vec time"
else
cargo doc
fi
continue-on-error: ${{ matrix.rust == 'nightly' }}
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ default = []
std = []

[package.metadata.docs.rs]
features = ["num-bigint", "bit-vec", "chrono", "std"]
features = ["num-bigint", "bit-vec", "time", "std"]

[dependencies]

Expand All @@ -39,8 +39,8 @@ default-features = false
features = ["std"]
optional = true

[dependencies.chrono]
version = "0.4"
[dependencies.time]
version = "0.3"
optional = true
default-features = false
features = ["std"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ This library is currently specialized for on-memory serialization/deserializatio
## Compatibility

The minimum supported Rust version (MSRV) of `yasna.rs` is Rust 1.36.0.
Optional feature flags that enable interoperability with third-party crates (e.g. `time`) follow the policy of that crate if stricter.

## License

Expand Down
6 changes: 3 additions & 3 deletions src/deserializer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use bit_vec::BitVec;

use super::{ASN1Result,BERMode,BERReader,parse_ber_general};
use super::models::{ObjectIdentifier,TaggedDerValue};
#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
use super::models::{UTCTime,GeneralizedTime};

/// Types decodable in BER.
Expand Down Expand Up @@ -233,14 +233,14 @@ impl BERDecodable for ObjectIdentifier {
}
}

#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
impl BERDecodable for UTCTime {
fn decode_ber(reader: BERReader) -> ASN1Result<Self> {
reader.read_utctime()
}
}

#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
impl BERDecodable for GeneralizedTime {
fn decode_ber(reader: BERReader) -> ASN1Result<Self> {
reader.read_generalized_time()
Expand Down
4 changes: 2 additions & 2 deletions src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#![forbid(missing_docs)]

mod oid;
#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
mod time;
mod der;

pub use self::oid::{ObjectIdentifier, ParseOidError};
#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
pub use self::time::{UTCTime,GeneralizedTime};
pub use self::der::TaggedDerValue;
Loading