I have some structs with fields of
T is a
String or enum that derives (De)Serailize. These structs are converted to/from query strings, e.g.
?field=value. The value of the field should be pipe delimited, e.g.
I'm using warp which helpfully deserializes the query strings to structs, so I'm currently adding
deserialize_with attributes to the struct fields that get this extra behaviour. I've come across implementations that use the
FromStr traits to achieve this to some extent serde_with::rust::StringWithSeparator - Rust. What I'd like to be able to do is split a string and defer to the enum's deserializer to do the rest (if it's an enum) and serialize an enum to string and join them together.
I've had a rough stab at this in Rust Playground but I'm not getting very far. Would anyone be able to suggest what I should do next?