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

Fix deser/ser impls in merde_time after phasing out JsonSerialize trait #110

Merged
merged 1 commit into from
Nov 20, 2024
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
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