I have a vector with a length of 32. I want to convert that to a string of 32 characters. I've tried several different paths with no success. The most obvious is listed below. I get an panic, error:
the code:
println!("converting pub key {:?} length {}", pub_address, pub_address.len());
let pub_address_str = str::from_utf8(&pub_address).unwrap();
the output:
converting pub key [225, 158, 21, 197, 56, 190, 97, 51, 247, 219, 177, 62, 82, 68, 241, 125, 22, 213, 234, 1, 205, 96, 13, 30, 239, 27, 146, 76, 94, 198, 196, 88] length 32
thread 'success_create_payment_with_seed_returns_address' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 0, error_len: Some(2) }', libcore/result.rs:945:5
On conversion, I expect pub_address_str looks like this "E3h79gOkwrgWehQw7MaguDHwyfTcDwls".
I appreciate the help. My apologizes if this is answered else where. I can't find an answer.
Thnx
Matt