Skip to content

NonZero internal Id representation#546

Merged
bors[bot] merged 1 commit intogfx-rs:masterfrom
kvark:non-zero
Apr 5, 2020
Merged

NonZero internal Id representation#546
bors[bot] merged 1 commit intogfx-rs:masterfrom
kvark:non-zero

Conversation

@kvark
Copy link
Copy Markdown
Member

@kvark kvark commented Mar 30, 2020

Fixes #544
Based on #545
Blocked by mozilla/cbindgen#500

@kvark kvark requested a review from grovesNL March 30, 2020 14:41
Copy link
Copy Markdown
Collaborator

@grovesNL grovesNL left a comment

Choose a reason for hiding this comment

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

Looks great once we can get cbindgen working with this 👍

let color_attachments = targets.colors
.iter()
.take_while(|at| at.attachment != id::TextureViewId::ERROR)
.take_while(|at| at.attachment != 0)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Although it probably won't happen often, it might still be nice to have associated constants for const ERROR: u64 = 0u64 on Id instead of comparing against 0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But the whole point here is that you can't have ERROR associated constant like this, since Id can't be that value ever :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh ok sounds good, I thought we were accepting an externally provided u64 here and trying to check if it's None

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh wait, you wrote ERROR: u64. Yes, sure, we could have such a constant, maybe under a different name.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, maybe NONE: u64 or something

@kvark kvark force-pushed the non-zero branch 3 times, most recently from 0e24615 to 69e3634 Compare April 4, 2020 22:46
@kvark kvark marked this pull request as ready for review April 4, 2020 22:56
@kvark
Copy link
Copy Markdown
Member Author

kvark commented Apr 4, 2020

bors r=grovesNL

bors bot added a commit that referenced this pull request Apr 4, 2020
546: NonZero internal Id representation r=grovesNL a=kvark

Fixes  #544
Based on #545 
Blocked by mozilla/cbindgen#500

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
@bors
Copy link
Copy Markdown
Contributor

bors bot commented Apr 4, 2020

Build failed

@kvark
Copy link
Copy Markdown
Member Author

kvark commented Apr 4, 2020

Good thing we have unit tests! :)
bors r=grovesNL

@bors
Copy link
Copy Markdown
Contributor

bors bot commented Apr 5, 2020

Build succeeded

@bors bors bot merged commit 902a0eb into gfx-rs:master Apr 5, 2020
@kvark kvark deleted the non-zero branch April 5, 2020 01:25
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.

Use NonZeroU64 for Id

2 participants