Skip to content

Remove rustc_serialize in favor of Serde crate #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ num = "0.1.32"
lazy_static = "0.2.1"

[build-dependencies]
rustc-serialize = "0.3.19"
serde_json = "1.0.0"
serde_derive = "1.0.1"
serde = "1.0.1"
rustc_version = "0.1.7"

[lib]
Expand Down
11 changes: 7 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* -- Lots of reuse from: https://github.com/alexcrichton/git2-rs/blob/master/libgit2-sys/build.rs */
extern crate rustc_serialize;
#[macro_use]
extern crate serde_derive;

extern crate serde;
extern crate serde_json;
extern crate rustc_version;

use std::env;
use std::fs;
use rustc_serialize::json;
use std::fs::OpenOptions;
use std::io::{ErrorKind, Read};
use std::path::PathBuf;
Expand All @@ -21,7 +24,7 @@ static UNIX_OCL_LIB_NAME: &'static str = "libafopencl";
static UNIX_UNI_LIB_NAME: &'static str = "libaf";

#[allow(dead_code)]
#[derive(RustcDecodable)]
#[derive(Deserialize, Debug)]
struct Config {
// Use the existing lib if it exists
use_lib: bool,
Expand Down Expand Up @@ -116,7 +119,7 @@ fn read_file(file_name: &std::path::PathBuf) -> String {

fn read_conf(conf_file: &std::path::PathBuf) -> Config {
let raw_conf = read_file(conf_file);
let decoded: Config = json::decode(&raw_conf).unwrap();
let decoded: Config = serde_json::from_str(&raw_conf).unwrap();
decoded
}

Expand Down