diff --git a/Cargo.toml b/Cargo.toml index 67bd6989f..f2d96ffee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ default-features = false [dev-dependencies] compiletest_rs = "0.3" -docopt = "0.7" +docopt = "0.8" rand = "0.3" -rustc-serialize = "0.3" +serde = "1" +serde_derive = "1" diff --git a/examples/cpu_monitor.rs b/examples/cpu_monitor.rs index 85b5f848d..4fedddb68 100644 --- a/examples/cpu_monitor.rs +++ b/examples/cpu_monitor.rs @@ -1,9 +1,10 @@ extern crate docopt; extern crate rayon; -extern crate rustc_serialize; +#[macro_use] +extern crate serde_derive; +extern crate serde; use docopt::Docopt; -use std::env; use std::io; use std::process; @@ -27,7 +28,7 @@ Options: -d N, --depth N Control how hard the dummy task works [default: 27] "; -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { arg_scenario: String, flag_depth: usize, @@ -35,7 +36,7 @@ pub struct Args { fn main() { let args: &Args = - &Docopt::new(USAGE).and_then(|d| d.argv(env::args()).decode()).unwrap_or_else(|e| e.exit()); + &Docopt::new(USAGE).and_then(|d| d.deserialize()).unwrap_or_else(|e| e.exit()); match &args.arg_scenario[..] { "tasks_ended" => tasks_ended(args), diff --git a/rayon-demo/Cargo.toml b/rayon-demo/Cargo.toml index 3a47f2c61..c7f3e7e61 100644 --- a/rayon-demo/Cargo.toml +++ b/rayon-demo/Cargo.toml @@ -6,16 +6,17 @@ publish = false [dependencies] rayon = { path = "../" } -cgmath = "0.14" -docopt = "0.7" -glium = "0.17" -rand = "0.3" -rustc-serialize = "0.3" -time = "0.1" -odds = "0.2" -lazy_static = "0.2.1" +cgmath = "0.15" +docopt = "0.8" fixedbitset = "0.1.5" +glium = "0.18" +lazy_static = "0.2.1" +odds = "0.2" +rand = "0.3" regex = "0.2" +serde = "1" +serde_derive = "1" +time = "0.1" [dev-dependencies] num = "0.1.30" diff --git a/rayon-demo/src/life/mod.rs b/rayon-demo/src/life/mod.rs index de4577283..4868f1c65 100644 --- a/rayon-demo/src/life/mod.rs +++ b/rayon-demo/src/life/mod.rs @@ -24,7 +24,7 @@ use rayon::prelude::*; #[cfg(test)] mod bench; -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { cmd_bench: bool, flag_size: usize, @@ -158,7 +158,7 @@ fn measure(f: fn(Board, usize) -> (), args: &Args) -> u64 { pub fn main(args: &[String]) { let args: Args = Docopt::new(USAGE) - .and_then(|d| d.argv(args).decode()) + .and_then(|d| d.argv(args).deserialize()) .unwrap_or_else(|e| e.exit()); if args.cmd_bench { diff --git a/rayon-demo/src/main.rs b/rayon-demo/src/main.rs index 8a4319dbe..222e58081 100644 --- a/rayon-demo/src/main.rs +++ b/rayon-demo/src/main.rs @@ -28,11 +28,13 @@ mod life; extern crate rayon; // all extern crate docopt; // all +#[macro_use] +extern crate serde_derive; // all +extern crate serde; // all extern crate cgmath; // nbody #[macro_use] extern crate glium; // nbody extern crate rand; // nbody -extern crate rustc_serialize; // nbody extern crate time; // nbody, sieve extern crate odds; // sieve #[cfg(test)] diff --git a/rayon-demo/src/matmul/mod.rs b/rayon-demo/src/matmul/mod.rs index fb9a62583..1de453fe5 100644 --- a/rayon-demo/src/matmul/mod.rs +++ b/rayon-demo/src/matmul/mod.rs @@ -10,7 +10,7 @@ Options: -h, --help Show this message. "; -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { cmd_bench: bool, flag_size: usize, @@ -369,7 +369,7 @@ fn timed_matmul(size: usize, f: F, name: pub fn main(args: &[String]) { let args: Args = Docopt::new(USAGE) - .and_then(|d| d.argv(args).decode()) + .and_then(|d| d.argv(args).deserialize()) .unwrap_or_else(|e| e.exit()); if args.cmd_bench { diff --git a/rayon-demo/src/mergesort/mod.rs b/rayon-demo/src/mergesort/mod.rs index d7f479e57..1d7455973 100644 --- a/rayon-demo/src/mergesort/mod.rs +++ b/rayon-demo/src/mergesort/mod.rs @@ -17,7 +17,7 @@ Options: -h, --help Show this message. "; -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { cmd_bench: bool, flag_size: usize, @@ -242,7 +242,7 @@ fn timed_sort(n: usize, f: F, name: &str) -> u64 { pub fn main(args: &[String]) { let args: Args = Docopt::new(USAGE) - .and_then(|d| d.argv(args).decode()) + .and_then(|d| d.argv(args).deserialize()) .unwrap_or_else(|e| e.exit()); if args.cmd_bench { diff --git a/rayon-demo/src/nbody/mod.rs b/rayon-demo/src/nbody/mod.rs index 1873b869a..ff50687ac 100644 --- a/rayon-demo/src/nbody/mod.rs +++ b/rayon-demo/src/nbody/mod.rs @@ -43,14 +43,14 @@ Ported from the RiverTrail demo found at: https://github.com/IntelLabs/RiverTrail/tree/master/examples/nbody-webgl "; -#[derive(Copy, Clone, PartialEq, Eq, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Deserialize)] pub enum ExecutionMode { Par, ParReduce, Seq, } -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { cmd_bench: bool, cmd_visualize: bool, @@ -62,7 +62,7 @@ pub struct Args { pub fn main(args: &[String]) { let args: Args = Docopt::new(USAGE) - .and_then(|d| d.argv(args).decode()) + .and_then(|d| d.argv(args).deserialize()) .unwrap_or_else(|e| e.exit()); if args.cmd_bench { diff --git a/rayon-demo/src/quicksort/mod.rs b/rayon-demo/src/quicksort/mod.rs index 8dfcf4fb0..918142ea9 100644 --- a/rayon-demo/src/quicksort/mod.rs +++ b/rayon-demo/src/quicksort/mod.rs @@ -15,7 +15,7 @@ Options: -h, --help Show this message. "; -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { cmd_bench: bool, flag_size: usize, @@ -121,7 +121,7 @@ fn timed_sort(n: usize, f: F, name: &str) -> u64 { pub fn main(args: &[String]) { let args: Args = Docopt::new(USAGE) - .and_then(|d| d.argv(args).decode()) + .and_then(|d| d.argv(args).deserialize()) .unwrap_or_else(|e| e.exit()); if args.cmd_bench { diff --git a/rayon-demo/src/sieve/mod.rs b/rayon-demo/src/sieve/mod.rs index eea7da92f..ef9a06a80 100644 --- a/rayon-demo/src/sieve/mod.rs +++ b/rayon-demo/src/sieve/mod.rs @@ -31,7 +31,7 @@ Options: -h, --help Show this message. "; -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { cmd_bench: bool, } @@ -179,7 +179,7 @@ fn measure(f: fn(usize) -> Vec) -> u64 { pub fn main(args: &[String]) { let args: Args = Docopt::new(USAGE) - .and_then(|d| d.argv(args).decode()) + .and_then(|d| d.argv(args).deserialize()) .unwrap_or_else(|e| e.exit()); if args.cmd_bench { diff --git a/rayon-demo/src/tsp/mod.rs b/rayon-demo/src/tsp/mod.rs index fd82e2650..bb03e9585 100644 --- a/rayon-demo/src/tsp/mod.rs +++ b/rayon-demo/src/tsp/mod.rs @@ -41,7 +41,7 @@ Options: --from N Node index from which to start the search [default: 0]. "; -#[derive(RustcDecodable)] +#[derive(Deserialize)] pub struct Args { cmd_bench: bool, arg_datafile: String, @@ -52,7 +52,7 @@ pub struct Args { pub fn main(args: &[String]) { let args: Args = Docopt::new(USAGE) - .and_then(|d| d.argv(args).decode()) + .and_then(|d| d.argv(args).deserialize()) .unwrap_or_else(|e| e.exit()); if args.cmd_bench {