Skip to content

Add pad_size_to for struct types - #250

Open
czaloj wants to merge 5 commits into
jam1garner:masterfrom
czaloj:struct_pad_size
Open

Add pad_size_to for struct types#250
czaloj wants to merge 5 commits into
jam1garner:masterfrom
czaloj:struct_pad_size

Conversation

@czaloj

@czaloj czaloj commented Mar 6, 2024

Copy link
Copy Markdown

pad_size_to on a struct should be able to reference import, temp variables, and generated fields.

Added StructGenerator::wrap_pad_size and smaller BinWrite implementation

3 new unit tests that check reading, one for write

@czaloj czaloj mentioned this pull request Mar 6, 2024
@csnover

csnover commented May 15, 2024

Copy link
Copy Markdown
Collaborator

I tried to update this PR to include enum but don’t have the bandwidth. It is confusing only to apply this to struct when enum is the same thing. Any chance you can make this change?

@csnover

csnover commented May 15, 2024

Copy link
Copy Markdown
Collaborator

Other feedback based on my trying to include enum: Being able to use a field from inside a struct to define the struct size is convenient for formats where the object size is stored that way, but also somewhat problematic because it violates some notion of scoping rules. As a result, code has to be emitted from a place where the field variables are available and can’t be done just once somewhere closer to generate.

@ismell

ismell commented Oct 8, 2024

Copy link
Copy Markdown

Any update on this? This functionality would be very useful in making the definitions a lot clearer.

@csnover

csnover commented Oct 8, 2024

Copy link
Copy Markdown
Collaborator

A volunteer is needed to handle the enum case.

@csnover csnover linked an issue Nov 27, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pad a vector's items

3 participants