some more "edition 2018" updates
`extern crate` and `#[macro_use]` are no longer needed
This commit is contained in:
parent
0596f72c8d
commit
cba32451b3
1 changed files with 13 additions and 21 deletions
34
src/main.rs
34
src/main.rs
|
@ -1,38 +1,30 @@
|
||||||
extern crate actix_web;
|
use actix_web::server;
|
||||||
extern crate bytes;
|
use actix_web::actix;
|
||||||
extern crate env_logger;
|
use env_logger;
|
||||||
extern crate futures;
|
use log;
|
||||||
extern crate tar;
|
use clap;
|
||||||
extern crate htmlescape;
|
|
||||||
extern crate percent_encoding;
|
|
||||||
#[macro_use] extern crate clap;
|
|
||||||
#[macro_use] extern crate log;
|
|
||||||
|
|
||||||
mod channel;
|
mod channel;
|
||||||
mod web;
|
mod web;
|
||||||
|
|
||||||
use actix_web::server;
|
|
||||||
use actix_web::actix;
|
|
||||||
use clap::Arg;
|
|
||||||
|
|
||||||
fn main() -> Result<(), std::io::Error> {
|
fn main() -> Result<(), std::io::Error> {
|
||||||
let app = clap::App::new(crate_name!())
|
let app = clap::App::new(clap::crate_name!())
|
||||||
.author(crate_authors!("\n"))
|
.author(clap::crate_authors!("\n"))
|
||||||
.version(crate_version!())
|
.version(clap::crate_version!())
|
||||||
.about(crate_description!())
|
.about(clap::crate_description!())
|
||||||
.arg(Arg::with_name("chdir")
|
.arg(clap::Arg::with_name("chdir")
|
||||||
.long("chdir")
|
.long("chdir")
|
||||||
.value_name("DIRECTORY")
|
.value_name("DIRECTORY")
|
||||||
.help("Specify directory to server")
|
.help("Specify directory to server")
|
||||||
.default_value(".")
|
.default_value(".")
|
||||||
.takes_value(true))
|
.takes_value(true))
|
||||||
.arg(Arg::with_name("addr")
|
.arg(clap::Arg::with_name("addr")
|
||||||
.long("bind")
|
.long("bind")
|
||||||
.value_name("ADDRESS")
|
.value_name("ADDRESS")
|
||||||
.help("Specify alternate bind address")
|
.help("Specify alternate bind address")
|
||||||
.default_value("0.0.0.0")
|
.default_value("0.0.0.0")
|
||||||
.takes_value(true))
|
.takes_value(true))
|
||||||
.arg(Arg::with_name("port")
|
.arg(clap::Arg::with_name("port")
|
||||||
.value_name("PORT")
|
.value_name("PORT")
|
||||||
.help("Specify alternate port")
|
.help("Specify alternate port")
|
||||||
.default_value("8000")
|
.default_value("8000")
|
||||||
|
@ -53,7 +45,7 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
|
|
||||||
let sys = actix::System::new("http_server_rs");
|
let sys = actix::System::new("http_server_rs");
|
||||||
|
|
||||||
info!("Serving files from {:?}", root);
|
log::info!("Serving files from {:?}", root);
|
||||||
server::new(move || web::create_app(&root).unwrap())
|
server::new(move || web::create_app(&root).unwrap())
|
||||||
.bind(&bind_addr)?
|
.bind(&bind_addr)?
|
||||||
.start();
|
.start();
|
||||||
|
|
Loading…
Add table
Reference in a new issue