The trait `serde::Deserialize<'_>` is not implemented for `chrono::DateTime<chrono::UTC>`

Hello!

I'm trying to update some crates in my project. I'm encountering this error:
the trait serde::Deserialize<'_> is not implemented for chrono::DateTime<chrono::UTC>

Only it appears that the have implemented this.. I'm assuming just not updated to serde 1.0?
This is based on this issue: https://github.com/chronotope/chrono/pull/51
And I actually looked at the source code itself.. and it looks like it's implemented to me? I tried implementing it myself on a wrapper around that class... and that looks like the right way to do it?

Am I call this wrong? Is this something obvious?

Would you have suggestions for me? Thank you!

4 Likes

Hey there! chrono 0.3.1 is using serde 1.0.

Is it your project that's failing to compile with this error or one of your dependencies? There's a chance that other dependency is using chrono but isn't up to date with the latest serde.

2 Likes

You'll need to make sure that chrono, and the crate attempting to call the Deserialize trait, are both using the same version of serde. You can see who is using what in your Cargo.lock file.

2 Likes

My bad... I was doing something stupid involving updating my main project to use chrono 0.3, but not a submodule within that project. Past this bug for now.

Thank you!!!

2 Likes

What worked for me in chrono: 0.4.0 was to include the "serde" feature as per the Chrono readme as of this date:

Or, if you want Serde or rustc-serialize support, include the features like this:

chrono = { version = "0.4", features = ["serde"] }

See "Usage" section of Chrono's ReadMe:

* https://github.com/chronotope/chrono#usage
14 Likes