fn load_or_gen_keys(keys_file: &str) -> (PublicKey, SecretKey) {
    match File::open(keys_file) {
        Ok(file) => load_keys(file),
        Err(ref e) if e.kind() == ErrorKind::NotFound => {
            info!("Generating new DHT keys and storing them to '{}'", keys_file);
            let (pk, sk) = gen_keypair();
            save_keys(keys_file, pk, &sk);
            (pk, sk)
        },
        Err(e) => panic!("Failed to read the keys file: {}", e)
    }
}
/// Load DHT keys from a binary file or generate and save them if file does not
/// exist.
Load DHT keys from a binary file or generate and save them if file does not
exist.
Load DHT keys from a binary file or generate and save them if file does not exist .
fn load_or_gen_keys(keys_file: &str) -> (PublicKey, SecretKey) {
    match File::open(keys_file) {
        Ok(file) => load_keys(file),
        Err(ref e) if e.kind() == ErrorKind::NotFound => {
            info!("Generating new DHT keys and storing them to '{}'", keys_file);
            let (pk, sk) = gen_keypair();
            save_keys(keys_file, pk, &sk);
            (pk, sk)
        },
        Err(e) => panic!("Failed to read the keys file: {}", e)
    }
}
fn load_or_gen_keys ( keys_file : & str ) -> ( PublicKey , SecretKey ) { match File :: open ( keys_file ) { Ok ( file ) => load_keys ( file ) , Err ( ref e ) if e . kind ( ) == ErrorKind :: NotFound => { info ! ( " " keys_file ) ; let ( pk , sk ) = gen_keypair ( ) ; save_keys ( keys_file , pk , & sk ) ; ( pk , sk ) } , Err ( e ) => panic ! ( " " e ) } }
Load DHT keys from a binary file or generate and save them if file does not
exist.
Load DHT keys from a binary file or generate and save them if file does not exist .
keys_file
&str
keys_file
&str