I'm trying to return Json data with a rocket handler. I've seen many other posts with the same issue, where the solution for basically everyone where that they hadn't implemented serde::Deserialize/serde::Serialize. Does anyone have a solution?
use rocket_contrib::json::Json;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct MyStruct;
pub fn get_timestamps(pool: &State<Pool>) -> Json<MyStruct> {
^^^^^^^^^^^^^^ the trait `Responder<'_, '_>` is not implemented for `rocket_contrib::json::Json<MyStruct>`
Cargo.toml
[dependencies]
rand = "0.8.4"
bytes = "1"
mysql = "*"
dotenv = "0.15.0"
serde = { version = "1", features = ["derive"] }
serde_derive = "1.0.127"
diesel = "1.4.7"
chrono = "0.4.19"
serde_json = "1.0"
rocket = "0.5.0-rc.1"
[dependencies.rocket_contrib]
version = "0.4"
default-features = false
features = ["json"]