Somewhat related to #144, it should be possible to create a procedural macro to implement forking operations for any struct. The most natural way to fork a struct would be through unzip. The macro could define a struct that replaces the fields of the original message with an Output<T> where T is the original type of each field. Then this struct could be used for the Unzipped associated type of Unzip.
For this to work with messages in JSON diagrams, we would also need to implement the PerformUnzip trait for Supported<Message, Serializer, Cloneable>, which is gated behind the diagram feature. It might prove challenging to make that work smoothly, so JSON diagram support might require either a second procedural macro or upstreaming some aspects of PerformUnzip into the Unzippable trait.
One way this relates to #144 is we should consider whether to make one Fork procedural macro that can apply to both enums and structs or whether to define separate macros for them.
Somewhat related to #144, it should be possible to create a procedural macro to implement forking operations for any struct. The most natural way to fork a struct would be through
unzip. The macro could define a struct that replaces the fields of the original message with anOutput<T>whereTis the original type of each field. Then this struct could be used for theUnzippedassociated type ofUnzip.For this to work with messages in JSON diagrams, we would also need to implement the
PerformUnziptrait forSupported<Message, Serializer, Cloneable>, which is gated behind thediagramfeature. It might prove challenging to make that work smoothly, so JSON diagram support might require either a second procedural macro or upstreaming some aspects ofPerformUnzipinto theUnzippabletrait.One way this relates to #144 is we should consider whether to make one
Forkprocedural macro that can apply to both enums and structs or whether to define separate macros for them.