Vec<String> を拡張すると定義外ってエラー出るんですけどなんでかわかる人います?
他のライブラリでVec拡張してるソース見ると特殊なことせずにimplできてるんですけどどうすればこのエラー取り除けますか?
impl From<Vec<&str>> for Vec<String> {
fn from(v: Vec<&str>) -> Self {
v.into_iter().map(String::from).collect()
}
}
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
|
88 | impl From<Vec<&str>> for Vec<String> {
| ^^^^^---------------^^^^^-----------
| | | |
| | | `std::vec::Vec` is not defined in the current crate
| | `std::vec::Vec` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|