比如现在一个结构体是
#[derive(Copy, Clone, Serialize, Deserialize)]
pub struct Setting {
pub language: String,
pub version: String,
pub updata: bool
}
// IDE 提示
th trait `Copy` may not be implemented for this type
查资料找到原因是因为有 String 类型变量 Can’t derive Copy because of String?, 大致意思理解为由于 String 是可变长的,在 Copy 的过程中可能会导致一些问题?
尝试将类型改 str 后报同样的错误,如果结构体中含有 Vec 数组的话也是同样的错误
如果结构体就是需要 String 和 Vec 类型的数据并且想要 derive Copy 的话有什么办法吗?或者说有什么更好的方法来定义这个结构体?