From bc0ff47394875e31e098e88b36f7711a5fb26fa1 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Fri, 20 Oct 2017 21:34:02 -0400 Subject: examples: upgrade to docopt 0.8 --- Cargo.toml | 5 +++-- examples/walkdir.rs | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8466780..11c87a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,8 @@ kernel32-sys = "0.2" winapi = "0.2" [dev-dependencies] -docopt = "0.7" +docopt = "0.8" quickcheck = { version = "0.4", default-features = false } rand = "0.3" -rustc-serialize = "0.3" +serde = "1" +serde_derive = "1" diff --git a/examples/walkdir.rs b/examples/walkdir.rs index d5d98d9..a0853e0 100644 --- a/examples/walkdir.rs +++ b/examples/walkdir.rs @@ -1,5 +1,7 @@ extern crate docopt; -extern crate rustc_serialize; +extern crate serde; +#[macro_use] +extern crate serde_derive; extern crate walkdir; use std::io::{self, Write}; @@ -23,7 +25,7 @@ Options: -d, --depth Show directory's contents before the directory itself. "; -#[derive(Debug, RustcDecodable)] +#[derive(Debug, Deserialize)] #[allow(dead_code)] struct Args { arg_dir: Option, @@ -40,8 +42,9 @@ struct Args { macro_rules! wout { ($($tt:tt)*) => { {writeln!($($tt)*)}.unwrap() } } fn main() { - let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()) - .unwrap_or_else(|e| e.exit()); + let args: Args = Docopt::new(USAGE) + .and_then(|d| d.deserialize()) + .unwrap_or_else(|e| e.exit()); let mind = args.flag_min_depth.unwrap_or(0); let maxd = args.flag_max_depth.unwrap_or(::std::usize::MAX); let dir = args.arg_dir.clone().unwrap_or(".".to_owned()); -- cgit v1.2.3