Skip to content

Commit

Permalink
Merge pull request #898 from oeb25/misplaced-chrono-feature
Browse files Browse the repository at this point in the history
scylla-cql: Use `#[cfg(feature = "time")]` for `time` related `impl SerializeCql`'s
  • Loading branch information
piodul authored Jan 3, 2024
2 parents 8263c53 + c23cad4 commit 2faeba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features ""
- name: Cargo check with all serialization features
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "full-serialization"
- name: Cargo check with secret feature
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "secret"
- name: Cargo check with chrono feature
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "chrono"
- name: Cargo check with time feature
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "time"
- name: Build scylla-cql
run: cargo build --verbose --all-targets --manifest-path "scylla-cql/Cargo.toml" --features "full-serialization"
- name: Build
Expand Down
6 changes: 3 additions & 3 deletions scylla-cql/src/types/serialize/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,21 @@ impl SerializeCql for NaiveTime {
<CqlTime as SerializeCql>::serialize(&cql_time, typ, writer)?
});
}
#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
impl SerializeCql for time::Date {
impl_serialize_via_writer!(|me, typ, writer| {
exact_type_check!(typ, Date);
<CqlDate as SerializeCql>::serialize(&(*me).into(), typ, writer)?
});
}
#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
impl SerializeCql for time::OffsetDateTime {
impl_serialize_via_writer!(|me, typ, writer| {
exact_type_check!(typ, Timestamp);
<CqlTimestamp as SerializeCql>::serialize(&(*me).into(), typ, writer)?
});
}
#[cfg(feature = "chrono")]
#[cfg(feature = "time")]
impl SerializeCql for time::Time {
impl_serialize_via_writer!(|me, typ, writer| {
exact_type_check!(typ, Time);
Expand Down

0 comments on commit 2faeba0

Please sign in to comment.