I am trying to add serialization functions to one of my structures in Rust. This event is for the calendar and looks like this:
#[derive(PartialEq, Clone, Encodable, Decodable)] pub struct Event { pub id: Uuid, pub name: String, pub desc: String, pub location: String, pub start: DateTime<Local>, pub end: DateTime<Local>, }
The structure uses two different types from third parties, Uuid from https://github.com/rust-lang/uuid and DateTime from https://github.com/lifthrasiir/rust-chrono .
If I try to build a project, the compiler complains that encode not found for Uuid and DateTime , because they both do not output Encodable and Decodeable from serialize crate.
So, the questions: Is there a way to add output to third-party structures without touching the libs code itself? If not, what is the best way to add serialization functions in this situation?
source share