在宏派生中指定生命周期
Specifying lifetimes in macro derives
如何在宏派生上指定生命周期?
#[derive(ElasticType, Serialize, Deserialize)]
pub struct Xkcd<'a> {
link: &'a str
}
错误示例:
#[derive(ElasticType, Serialize, Deserialize)]
| ^^^^^^^^^^^ expected lifetime parameter
在您的代码中,您根本无法解决此问题。这是提供 #[derive(ElasticType)]
.
的板条箱中的错误
向 ElasticType
的作者提交错误!如果由于某种原因无法添加对生命周期结构的支持,它至少应该发出一条有用的错误消息来说明这一点。
如何在宏派生上指定生命周期?
#[derive(ElasticType, Serialize, Deserialize)]
pub struct Xkcd<'a> {
link: &'a str
}
错误示例:
#[derive(ElasticType, Serialize, Deserialize)]
| ^^^^^^^^^^^ expected lifetime parameter
在您的代码中,您根本无法解决此问题。这是提供 #[derive(ElasticType)]
.
向 ElasticType
的作者提交错误!如果由于某种原因无法添加对生命周期结构的支持,它至少应该发出一条有用的错误消息来说明这一点。