les*_*how 1 string vector rust
将我的代码更新到新的 nightlies 似乎他们已经摆脱了 std::Vec 的 to_string()
src/rust_mnemonic.rs:100:39: 100:50 error: type `collections::vec::Vec<&str>` does not implement any method in scope named `to_string`
rc/rust_mnemonic.rs:100 println!("mnemonic: {}", mnemonic.to_string());
Run Code Online (Sandbox Code Playgroud)
您可以使用:?使用Debugtrait的说明符。
fn main() {
let v = vec![0u8, 1, 2, 3, 4, 5];
println!("{:?}", v);
}
Run Code Online (Sandbox Code Playgroud)
如果你想要它作为String,那么你可以使用format!:
fn main() {
let v = vec![0u8, 1, 2, 3, 4, 5];
let s = format!("{:?}", v);
println!("-->{}<--", s);
}
Run Code Online (Sandbox Code Playgroud)