mod client; mod server; type Result = std::result::Result>; 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()), } }