Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Range::new_from_bounds #2148

Merged
merged 1 commit into from
Dec 12, 2022
Merged

Conversation

robtfm
Copy link
Contributor

@robtfm robtfm commented Dec 5, 2022

when working with naga IR i've found i need to be able to construct Ranges (specifically for Statement::Emit which can't be constructed otherwise). it is possible currently, but only via serde hacking.

i added a Range::new_from_bounds method to allow construction.

first PR, apologies if i missed any standard process.

@teoxoy
Copy link
Member

teoxoy commented Dec 6, 2022

i need to be able to construct Ranges (specifically for Statement::Emit which can't be constructed otherwise).

What about using Arena.range_from? That's what we use in our front-ends.

@robtfm
Copy link
Contributor Author

robtfm commented Dec 6, 2022

thanks, i could work with that if i had to, but it's a bit awkward as i'm not building statements and expressions in tandem.

my context is i am removing parts of naga modules, so i iterate through determining my filter for the various parts, then rebuild expressions and blocks (etc) separately afterwards. i guess i could rework it if you're opposed to adding this.

@teoxoy
Copy link
Member

teoxoy commented Dec 12, 2022

I see, so you are using this serde_range "hack" to do this.

@teoxoy teoxoy merged commit 2dcb696 into gfx-rs:master Dec 12, 2022
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.

2 participants