I came across this type conversion in chrono
.
Specifically, DateTime::from_utc(datetime: NaiveDateTime, ...)
.
let from: DateTime<Utc> = DateTime::from_utc(NaiveDate::from_ymd(2020, 1, 1), Utc);
let date: DateTime<Utc> = DateTime::from_utc(NaiveDateTime::from_timestamp( 8_210_298_412_799, 1_000_000_000), Utc);
It accepts NaiveDateTime
(as expected) but also accepts NaiveDate
. I don't see any inheritance-like relation. What is actually going on?
Edit: Nothing wrong here. Silly of me to post such a shitty question. I was head banging (without even compiling) as the intellij-rust was not giving me error hints. So, I thought the statements were correct. Sorry. And, I cannot delete this question.