diff --git a/ui/Cargo.toml b/ui/Cargo.toml index ff66bd2d6..8050c82cb 100644 --- a/ui/Cargo.toml +++ b/ui/Cargo.toml @@ -8,6 +8,7 @@ workspace = ".." xdg = "2.1.0" serde = "1.0.71" serde_derive = "1.0.71" +serde_json = "1.0" config = "0.6" chan = "0.1.21" chan-signal = "0.3.1" diff --git a/ui/src/conf/accounts.rs b/ui/src/conf/accounts.rs index 3024fdd53..43c2698a3 100644 --- a/ui/src/conf/accounts.rs +++ b/ui/src/conf/accounts.rs @@ -67,6 +67,7 @@ pub struct Account { impl Drop for Account { fn drop(&mut self) { + //TODO: Avoid panics let data_dir = xdg::BaseDirectories::with_profile("meli", &self.name) .unwrap(); @@ -79,7 +80,7 @@ impl Drop for Account { } }; let writer = io::BufWriter::new(f); - bincode::serialize_into(writer, &self.address_book).unwrap(); + serde_json::to_writer(writer, &self.address_book).unwrap(); }; } } @@ -104,7 +105,7 @@ impl Account { let address_book = if let Ok(data) = data_dir.place_data_file("addressbook") { if data.exists() { let reader = io::BufReader::new(fs::File::open(data).unwrap()); - let result: result::Result = bincode::deserialize_from(reader); + let result: result::Result = serde_json::from_reader(reader); if let Ok(mut data_t) = result { data_t } else { diff --git a/ui/src/lib.rs b/ui/src/lib.rs index 7a8ba50ac..f53eb565c 100644 --- a/ui/src/lib.rs +++ b/ui/src/lib.rs @@ -40,6 +40,8 @@ extern crate termion; #[macro_use] extern crate nom; +extern crate serde_json; + use melib::*; use std::collections::VecDeque;