Closed
Description
Take the following struct as example:
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Debug, Serialize, Deserialize)]
pub struct Authorization {
#[serde(with = "bson::serde_helpers::uuid_as_binary")]
client_id: Uuid,
dbs: Vec<String>,
colls: Option<Vec<String>>,
#[serde(with = "bson::serde_helpers::chrono_datetime_as_bson_datetime")]
start_date: Option<DateTime<Utc>>,
#[serde(with = "bson::serde_helpers::chrono_datetime_as_bson_datetime")]
end_date: Option<DateTime<Utc>>,
name: String,
}
When I try to complile, I get the following error message:
mismatched types
= note: expected reference `&chrono::DateTime<Utc>`
found reference `&'__a std::option::Option<chrono::DateTime<Utc>>`
I think this should work for start_date
and end_date
field just like colls
field in the given Authorization
struct, sorry for that I go through documentation and can't find out an answer, am I miss something?