Skip to content

Enum Structs #97

@nicholascioli

Description

@nicholascioli

I've used this library for a while and it has been great, but I was wondering if something like packed enum variants would be something that could be potentially in scope for this project.

I have a packed message that, depending on the tag (the first two bytes), has a different layout per message type. Would this library be able to do handle something like the following?

enum Message {
  // When the first two bytes are 0x16
  Variant1 { field1: String, field2: u64 },
  
  // When the first two bytes are 0x01
  Variant2 { other_field1: u8 }
}

Or is this better handled as a separate library? I don't mind contributing, if this seems within scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions