Browse Source

Add --async command line switch.

wip
Titouan Rigoudy 4 years ago
parent
commit
f6a6d190ef
3 changed files with 79 additions and 3 deletions
  1. +52
    -0
      Cargo.lock
  2. +1
    -0
      client/Cargo.toml
  3. +26
    -3
      client/src/main.rs

+ 52
- 0
Cargo.lock View File

@ -11,6 +11,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "async-stream"
version = "0.3.2"
@ -113,6 +122,21 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "2.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
dependencies = [
"ansi_term",
"atty",
"bitflags 1.2.1",
"strsim",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
name = "cloudabi"
version = "0.0.3"
@ -1098,6 +1122,7 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
name = "solstice-client"
version = "0.1.0"
dependencies = [
"clap",
"crossbeam-channel",
"env_logger",
"log 0.4.14",
@ -1139,6 +1164,12 @@ dependencies = [
"tokio-io",
]
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "syn"
version = "1.0.73"
@ -1159,6 +1190,15 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "thiserror"
version = "1.0.26"
@ -1464,6 +1504,12 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-width"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
version = "0.2.2"
@ -1481,6 +1527,12 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"


+ 1
- 0
client/Cargo.toml View File

@ -5,6 +5,7 @@ authors = ["letitz"]
edition = "2018"
[dependencies]
clap = "^2.33"
crossbeam-channel = "^0.3"
env_logger = "^0.8"
log = "^0.4"


+ 26
- 3
client/src/main.rs View File

@ -4,6 +4,7 @@ extern crate log;
use std::thread;
use clap::{App, Arg};
use crossbeam_channel;
use env_logger;
use solstice_proto;
@ -24,9 +25,7 @@ mod message_handler;
mod room;
mod user;
fn main() {
env_logger::init();
fn old_main() {
let (proto_to_client_tx, proto_to_client_rx) = crossbeam_channel::unbounded();
let mut proto_agent = match solstice_proto::Agent::new(proto_to_client_tx) {
@ -51,3 +50,27 @@ fn main() {
thread::spawn(move || proto_agent.run().unwrap());
client.run();
}
fn async_main() {
// TODO
}
fn main() {
env_logger::init();
let matches = App::new("solstice-client")
.version("0.1")
.author("letitz")
.arg(
Arg::with_name("async")
.long("async")
.help("Use the new async engine."),
)
.get_matches();
if matches.is_present("async") {
async_main();
} else {
old_main();
}
}

Loading…
Cancel
Save