我试图用一些可以在代码中重用的设置初始化Vec<String>
.
我使用的是const left: Vec<String> = vec![...
,但这不起作用:
error[E0308]: mismatched types
--> names-generator.rs:2:27
|
2 | const left: Vec<String> = vec![
| ^ expected slice, found array of 93 elements
|
= note: expected type `Box<[std::string::String]>`
= note: found type `Box<[&str; 93]>`
= note: this error originates in a macro outside of the current crate
这样做的推荐方式是什么?