Skip to content

Derive forking for any struct #145

@mxgrey

Description

@mxgrey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions