From 5d6c5663170303cf41f7f90f79ac9737ab5e2d00 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Wed, 8 Dec 2021 23:55:22 +0000 Subject: [PATCH] :heavy_plus_sign: add Tokio dep Release build only went from 1.9 to 2.0 MB, but that could cause I'm not really using Tokio yet --- Cargo.lock | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/main.rs | 8 +++++++ 3 files changed, 69 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 8c2ed46..699b465 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,6 +43,15 @@ version = "0.2.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01" +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if", +] + [[package]] name = "lookaround" version = "0.1.4" @@ -50,6 +59,7 @@ dependencies = [ "mac_address", "rand", "thiserror", + "tokio", ] [[package]] @@ -71,6 +81,28 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mio" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + [[package]] name = "nix" version = "0.22.2" @@ -84,6 +116,21 @@ dependencies = [ "memoffset", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" + [[package]] name = "ppv-lite86" version = "0.2.15" @@ -179,6 +226,19 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144" +dependencies = [ + "autocfg", + "libc", + "mio", + "pin-project-lite", + "winapi", +] + [[package]] name = "unicode-xid" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index 91977d2..bf7333b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ version = "0.1.4" mac_address = "1.1.2" rand = "0.8.4" thiserror = "1.0.30" +tokio = { version = "1.14.0", features = ["fs", "net", "rt", "time"] } [profile.release] codegen-units = 1 diff --git a/src/main.rs b/src/main.rs index 0e37516..e025d29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,6 +76,14 @@ impl Default for CommonParams { } fn main () -> Result <(), AppError> { + let rt = tokio::runtime::Builder::new_current_thread ().build ()?; + + rt.block_on (async_main ())?; + + Ok (()) +} + +async fn async_main () -> Result <(), AppError> { let mut args = env::args (); let _exe_name = args.next ();