我试图利用DateTime从rust chrono crate 到我自己的特点.
#[derive(Debug, RustcEncodable, RustcDecodable)]
pub struct Accomplishment {
name: String,
accomplishment_type: String,
date: DateTime<UTC>
}
当我试图编译它时,它抱怨说
src/lib.rs:11:33: 11:47 error: the trait `rustc_serialize::serialize::Decodable` is not implemented for the type `chrono::datetime::DateTime<chrono::offset::utc::UTC>` [E0277]
src/lib.rs:11 #[derive(Debug, RustcEncodable, RustcDecodable)]
当我判断github repo of chrono时,它实现了rustc_序列化支持.但这是一个特点.在commit log年,它做到了
cargo test -v --features rustc-serialize
我不确定如何在我的项目中使用此功能.有人能帮我把chrono和rustc serialize一起使用吗?
关于这一点,有similar question分.但我想要的是在我的项目中使用chrono中提供的序列化支持,而不实现包装器特性.