Skip to content

NonZero internal Id representation - #546

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

bors[bot] merged 1 commit into
gfx-rs:masterfrom
kvark:non-zero

Conversation

@kvark

@kvark kvark commented Mar 30, 2020

Copy link
Copy Markdown
Member

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

@kvark
kvark requested a review from grovesNL March 30, 2020 14:41

@grovesNL grovesNL left a comment

Copy link
Copy Markdown
Contributor

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
Contributor

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
Contributor

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
Contributor

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

kvark commented Apr 4, 2020

Copy link
Copy Markdown
Member Author

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

bors Bot commented Apr 4, 2020

Copy link
Copy Markdown
Contributor

Build failed

@kvark

kvark commented Apr 4, 2020

Copy link
Copy Markdown
Member Author

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

@bors

bors Bot commented Apr 5, 2020

Copy link
Copy Markdown
Contributor

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