open-rmf / open-rmf/crossflow

Derive forking for any struct

Open
#145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
72
Forks
16
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Fork work referenced by #144, then inspect the Unzip, Unzipped, PerformUnzip, and Supported<Message, Serializer, Cloneable> entry points. Determine the procedural-macro scope for structs and whether JSON diagram support belongs in the same macro or requires changes to Unzippable; done means the chosen design supports struct forking and its required diagram behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.