File: main.rs

package info (click to toggle)
rust-async-std 1.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,992 kB
  • sloc: sh: 13; makefile: 8
file content (13 lines) | stat: -rw-r--r-- 406 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
mod client;
mod server;

type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

fn main() -> Result<()> {
    let mut args = std::env::args();
    match (args.nth(1).as_ref().map(String::as_str), args.next()) {
        (Some("client"), None) => client::main(),
        (Some("server"), None) => server::main(),
        _ => Err("Usage: a-chat [client|server]".into()),
    }
}