Skip to content

Indices::push(u32)#16014

Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom
stepancheg:indices-push
Oct 20, 2024
Merged

Indices::push(u32)#16014
alice-i-cecile merged 1 commit intobevyengine:mainfrom
stepancheg:indices-push

Conversation

@stepancheg
Copy link
Copy Markdown
Contributor

Objective

Making work with Indices struct easier. Currently when building indices in some quick-and-dirty code we need to do matches and handle enum variants.

Solution

Indices::push utility which works transparently with U16 and U32 variants.

Testing

Unit test added.

@stepancheg
Copy link
Copy Markdown
Contributor Author

Also, there's silent integer overflow in this code:

(Indices::U16(i1), Indices::U16(i2)) => {
i1.extend(i2.iter().map(|i| *i + index_offset as u16));
}

This code could benefit from changes like this (but not this directly).

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Uncontroversial This work is generally agreed upon S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged D-Straightforward Simple bug fixes and API improvements, docs, test and examples D-Domain-Agnostic Can be tackled by anyone with generic programming or Rust skills labels Oct 19, 2024
@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Oct 20, 2024
Copy link
Copy Markdown
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I like the auto conversion, but it's not a blocker for me.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 20, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 20, 2024
Merged via the queue into bevyengine:main with commit 0cc5345 Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Domain-Agnostic Can be tackled by anyone with generic programming or Rust skills D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants