Skip to content

Unable to use a variable length structure #3

Description

@brutella

How would I use DataKit to encode a variable length structure?

My bytes representation looks like this.

( 1 Byte )
[ Length ][ Type ][ ID ][ Version ]...[ ID ][ Version ]

(Length is the overall byte count.)

I've tried to create a struct but I'm unable to provide a write format.

typealias ID = UInt8
typealias Version = UInt8
struct InfoBlock {
    let blockType: UInt8
    let values: [ID:Version]
}

How would the format look like to map it to the above mentioned bytes representation?

Thanks for the help.

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