More map_label changes#9526
Open
andyleiserson wants to merge 4 commits intogfx-rs:trunkfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A few changes that build on #9480 and #9481:
map_label_and_view_formatsto takeview_formatsby reference #9481 since it's technically an API changemap_label-style helpers (except forCreateShaderModuleDescriptorPassthrough) to have explicit lifetimes on references in the arguments. This allows doingfoo.map_label(|l| l.as_ref()), with the lifetime passing through.CreateShaderModuleDescriptorPassthroughis excluded because it has a lifetime parameter that is also passed through as a lifetime parameter on embedded structs, which prevents re-borrowing a&CreateShaderModuleDescriptorPassthroughwith a shorter lifetime, which makes a mess of things if the lifetimes are bound.TextureDescriptorpassed tocreate_textureby theview_formatstypeV: AsRef<[TextureFormat]>. This lets you pass&desctocreate_texturewhendeschas aSmallVec(or other owned type) forview_formats.The third change seems the most controversial, since it is putting a type parameter in the API in a way that I don't see precedent for. Without this change, applications have to pass
&desc.map_label_and_view_formats(Option::clone, |v| v.as_ref())tocreate_texture. Which, now that I write this up... doesn't seem that bad given that most of the time theview_formatsis&[]anyways. So maybe we take this out.Testing
Refactoring checked by Rust type system. It builds ⇒ shippit.
Squash or Rebase? Rebase (after squashing fixups)
Checklist
wgpumay be affected behaviorally.CHANGELOG.mdentries for the user-facing effects of this change are present.