fn parse_args() -> CliArgs {
    let mut parsed_args = CliArgs::default();
    let args: Vec<_> = std::env::args().collect();

    if args.len() < 2 {
        log::info!("cli args must be not less than 2: cargo run <node_id> <port_num>");
    }
    {
        use std::str::FromStr;
        parsed_args.id = u8::from_str(&args[1]).expect("node id");
        parsed_args.port = u16::from_str(&args[2]).expect("port number");
    }
    if args.len() > 3 && !args[3].is_empty() {
        parsed_args.bootnode = Some(args[3].clone());
    }

    parsed_args
}
//Parses the command line args.
Parses the command line args.
Parses the command line args .
fn parse_args() -> CliArgs {
    let mut parsed_args = CliArgs::default();
    let args: Vec<_> = std::env::args().collect();
    if args.len() < 2 {
        log::info!("cli args must be not less than 2: cargo run <node_id> <port_num>");
    }
    {
        use std::str::FromStr;
        parsed_args.id = u8::from_str(&args[1]).expect("node id");
        parsed_args.port = u16::from_str(&args[2]).expect("port number");
    }
    if args.len() > 3 && !args[3].is_empty() {
        parsed_args.bootnode = Some(args[3].clone());
    }
    parsed_args
}
fn parse_args ( ) -> CliArgs { let mut parsed_args = CliArgs :: default ( ) ; let args : Vec < _ > = std :: env :: args ( ) . collect ( ) ; if args . len ( ) < 2 { log :: info ! ( " " ) ; } { use std :: str :: FromStr ; parsed_args . id = u8 :: from_str ( & args [ 1 ] ) . expect ( " " ) ; parsed_args . port = u16 :: from_str ( & args [ 2 ] ) . expect ( " " ) ; } if args . len ( ) > 3 && ! args [ 3 ] . is_empty ( ) { parsed_args . bootnode = Some ( args [ 3 ] . clone ( ) ) ; } parsed_args }
Parses the command line args.
Parses the command line args .