oxidecomputer / oxidecomputer/typify

look through references to improve externally tagged `enum` generation

Open
#178 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
898
Forks
114
Avg merge
4h 18m
Merged PRs (30d)
14

Description

This is a possible solution to some of the gnarly Vega code generation. Several of the more complex types end up with many VariantN layers (like @ahl mentioned in #165).

For example we have:

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum AlignValueVariant0ItemSubtype1Subtype1Subtype0 {
    Variant0(SignalRef),
    Variant1 {
        value: AlignValueVariant0ItemSubtype1Subtype1Subtype0Variant1Value,
    },
    Variant2 {
        field: Field,
    },
    Variant3 {
        range: AlignValueVariant0ItemSubtype1Subtype1Subtype0Variant3Range,
    },
}

It might be okay to replace instances of that enum with something like Box<dyn AsVegaAlign>.

Contributor guide

No contributing guide indexed for this repository

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

No files or tests are named. Start by tracing externally tagged enum generation and references to the generated VariantN types, using the Vega example and issue #165 as context; determine whether replacing these enums with Box is viable and define the expected generated output before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.