on the structs, and recursively the contained structs
My struct writes logs so has a reference to a struct that has a a BufWriter (it writes logs of the computations it is involved with) and I get the error:
serde::Serialize is not implemented for std::io::BufWriter<std::fs::File>
I tried putting #[serde(skip_serializing)] before the offending field to no avail. (I do not need to serialise the reference to the log writer).
You probably don't want to have the struct that writes logs annotated with Serialize or Deserialize. Instead, you should be annotating structs that represent a record/row in the log.
Can you expand a bit on why you have the current setup?
So Fud will be json serialized somewhere as well as writing to the BufWriter directly? If so, you should make a view of Fud (i.e. a separate struct) that is used for json (serde) serialization. So something like:
I see. For my needs, currently, that is a nice solution.
The point being I cannot include a BufWWriter in a serialised object? That would make some sense, but I could see a case where I would want to resume logging.
That's right - there's no implementation of serialization for it, which makes sense because it's not an object you'd want to serialize (under reasonable circumstances). You could, for example, store it as a Option<BufWriter<File>>, and add #[serde(skip)] so that it'll be ignored. But that pollutes your type with an otherwise unnecessary Option.
Whatever has a serde::ser::Serialize - Rust implementation for it, which may also be (frequently) derived (like you were trying to do for your types).
If you've not yet, you may want to read through https://serde.rs/ to get a better understanding of serde.