Skip to content

Commit

Permalink
Fix deser/ser impls in merde_time after phasing out JsonSerialize trait
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Nov 20, 2024
1 parent 1b7633d commit f379556
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion merde/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ serde = ["merde_core/serde"]
rusqlite = ["merde_core/rusqlite"]

# non-core crates
json = ["dep:merde_json", "merde_time/json"]
json = ["dep:merde_json"]
yaml = ["dep:merde_yaml"]
msgpack = ["dep:merde_msgpack"]
time = ["dep:merde_time"]
Expand Down
5 changes: 3 additions & 2 deletions merde_time/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ merde_json = { version = "8.0.1", path = "../merde_json", optional = true }
time = "0.3.36"

[dev-dependencies]
merde_json = { path = "../merde_json" }
time = { version = "0.3.36", features = ["macros"] }

[features]
default = []
full = ["merde", "json", "serialize", "deserialize"]
full = ["merde", "serialize", "deserialize"]
merde = ["dep:merde_core"]
json = ["merde", "dep:merde_json", "serialize"]
json = []
serialize = ["time/formatting"]
deserialize = ["merde", "time/parsing"]
11 changes: 3 additions & 8 deletions merde_time/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Provides [Rfc3339], a wrapper around [time::OffsetDateTime] that implements
//! [merde_json::JsonSerialize] and [merde_core::Deserialize] when the right
//! [merde_core::Serialize] and [merde_core::Deserialize] when the right
//! cargo features are enabled.
use std::{
Expand All @@ -9,7 +9,7 @@ use std::{

pub use time::OffsetDateTime;

/// A wrapper around date-time types that implements `JsonSerialize` and `JsonDeserialize`
/// A wrapper around date-time types that implements `Serialize` and `Deserialize`
/// when the right cargo features are enabled.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
Expand Down Expand Up @@ -81,11 +81,6 @@ mod merde_impls {
))
}
}
}

#[cfg(feature = "json")]
mod merde_json_impls {
use super::*;

#[cfg(feature = "serialize")]
impl merde_core::Serialize for Rfc3339<time::OffsetDateTime> {
Expand All @@ -104,7 +99,7 @@ mod merde_json_impls {
}
}

#[cfg(all(test, feature = "full",))]
#[cfg(all(test, feature = "full"))]
mod tests {
use super::*;
use merde_json::{from_str, JsonSerialize};
Expand Down

0 comments on commit f379556

Please sign in to comment.