1 use serde::{Serialize, Deserialize};
3 #[derive(Serialize, Deserialize, Debug)]
10 #[derive(Serialize, Deserialize, Debug)]
17 type Contacts = Vec<Contact>;
19 fn build_contacts() -> Contacts {
21 Contact { name: "John".to_string(), phone: 12345, social: Social::Twitter("@the_john".to_string()) },
22 Contact { name: "Mary".to_string(), phone: 9876543, social: Social::ICQ(111234) },
23 Contact { name: "Jane".to_string(), phone: 555555, social: Social::Nothing },
27 fn create_contacts() {
28 let contacts = build_contacts();
29 // FIXME: Use ? and return Result
30 let serialized = serde_json::to_string(&contacts).unwrap();
31 println!("serialized: {}", serialized);