Mercurial > templog
diff rust/src/main.rs @ 632:bde302def78e rust
moving to riker, nowhere near yet
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 22 Aug 2019 23:59:50 +0800 |
parents | c57821a60e51 |
children | 490e9e15b98c |
line wrap: on
line diff
--- a/rust/src/main.rs Sat Jul 06 18:28:34 2019 +0800 +++ b/rust/src/main.rs Thu Aug 22 23:59:50 2019 +0800 @@ -1,38 +1,7 @@ -#![feature(proc_macro, conservative_impl_trait, generators)] -#![feature(await_macro, async_await, futures_api)] - - -#[macro_use] -extern crate tokio; -#[macro_use] -extern crate futures; +#[macro_use] extern crate log; +// riker has its own logging? +//extern crate env_logger; -#[macro_use] -extern crate log; -extern crate env_logger; -extern crate rustc_serialize; -extern crate time; -extern crate serde_json; -extern crate libc; -extern crate atomicwrites; -extern crate hyper; - -#[macro_use] -extern crate lazy_static; - -#[macro_use] -extern crate serde_derive; -extern crate serde; - -extern crate toml; - -extern crate docopt; - -use std::io; - -use tokio_core::reactor:: Core; -use futures::{Stream,Sink,Future}; -use futures::sync::{mpsc}; use sensor::Sensor; mod config; @@ -122,6 +91,18 @@ flag_nowait: bool, } +fn handle_args() -> Args { + let args: Args = docopt::Docopt::new(USAGE).and_then(|d| d.decode()).unwrap_or_else(|e| e.exit()); + + if args.flag_defconf { + println!("Default configuration:\n{}\n\n{}", + "(custom options go in local.conf)", + config::Config::default().to_toml_string()); + std::process::exit(0); + } + args +} + fn setup_log(debug: bool) { let loglevel = if debug { log::LogLevelFilter::Debug @@ -141,18 +122,6 @@ builder.init().unwrap(); } -fn handle_args() -> Args { - let args: Args = docopt::Docopt::new(USAGE).and_then(|d| d.decode()).unwrap_or_else(|e| e.exit()); - - if args.flag_defconf { - println!("Default configuration:\n{}\n\n{}", - "(custom options go in local.conf)", - config::Config::default().to_toml_string()); - std::process::exit(0); - } - args -} - fn load_config() -> Config { let nconfig = config::Config::default();