Why am I getting this lifetime error?
Thanks!
Check out https://serde.rs/lifetimes.html and https://serde.rs/borrow.html.
Thanks, I got it working for structs with #[serde(borrow)]
but how can I make it work for enums?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum Msg<'a> {
#[serde(borrow)]
System(SystemTransaction<'a>),
#[serde(borrow)]
Item(ItemTransaction<'a>),
}
error: proc-macro derive panicked
help: message: 2 errors:
# unknown serde variant attribute `borrow`
# unknown serde variant attribute `borrow`
@Boscop this is a field attribute, not a variant one:
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum Msg<'a> {
System(#[serde(borrow)] SystemTransaction<'a>),
Item(#[serde(borrow)] ItemTransaction<'a>),
}