I tried to derive serde::Deserialize for a struct containing a reference to a Path. This yielded an error message which doesn\'t occur if you repla
serde::Deserialize
Path
Add an attribute to the field: #[serde(borrow)]. That will indicate to serde that it should be borrowing the value. You must provide this attribute for every borrow except for &str and &[u8].
#[serde(borrow)]
&str
&[u8]
Source: https://serde.rs/lifetimes.html#borrowing-data-in-a-derived-impl