Skip to content

Conversation

@kpreid
Copy link
Collaborator

@kpreid kpreid commented Dec 1, 2025

Connections
Part of #8596.

Description
Breaks up wgpu-types/src/lib.rs into more files. The criteria used for subdivision are:

  • Maximum unit: Files should be 1000 lines or shorter. (texture/format.rs is an exception.)
  • Minimum: There are multiple items which are useful to read together.

Beyond the strictly necessary, I also added warn(unused_qualifications). This lint is useful to keep code more consistent during any future moves, and in general when there are many modules and use ::*s.

$ git diff trunk --stat wgpu-types/src/adapter.rs | 220 +++++ wgpu-types/src/backend.rs | 674 ++++++++++++++ wgpu-types/src/binding.rs | 341 +++++++ wgpu-types/src/buffer.rs | 162 ++++ wgpu-types/src/counters.rs | 4 +- wgpu-types/src/device.rs | 103 ++ wgpu-types/src/instance.rs | 475 +--------- wgpu-types/src/lib.rs | 8354 +++++-------------------------------------------------------------------------------------------------------------------------------------------------------------- wgpu-types/src/limits.rs | 920 ++++++++++++++++++ wgpu-types/src/origin_extent.rs | 192 ++++ wgpu-types/src/ray_tracing.rs | 177 ++++ wgpu-types/src/render.rs | 941 +++++++++++++++++++ wgpu-types/src/send_sync.rs | 67 ++ wgpu-types/src/shader.rs | 185 ++++ wgpu-types/src/surface.rs | 323 +++++++ wgpu-types/src/texture.rs | 1098 ++++++++++++++++++++++ wgpu-types/src/texture/external_image.rs | 160 ++++ wgpu-types/src/texture/external_texture.rs | 167 ++++ wgpu-types/src/texture/format.rs | 2482 +++++++++++++++++++++++++++++++++++++++++++++++++ wgpu-types/src/vertex.rs | 282 ++++++ 20 files changed, 8736 insertions(+), 8591 deletions(-) 

Testing
xtask test + cargo doc

Squash or Rebase?
Ideally this would be merged strictly as a fast-forward to minimize the chance of mis-merges, but GitHub doesn't let you do that, so, uh, rebase.

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.
@kpreid kpreid force-pushed the splitfile branch 2 times, most recently from 69bb631 to 65c1cd9 Compare December 1, 2025 18:18
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Some nits and a question, but we can deal with all of them in a follow up

The criteria used for subdivision are: * Maximum unit: Files should be 1000 lines or shorter. (`texture/format.rs` is an exception.) * Minimum: There are multiple items which are useful to read together. Beyond the strictly necessary, I also added `warn(unused_qualifications)`. This lint is useful to keep code more consistent during any future moves, and in general when there are many modules and `use ::*`s.
@kpreid
Copy link
Collaborator Author

kpreid commented Dec 1, 2025

CI is happy now.

@cwfitzgerald
Copy link
Member

Lets go!

@cwfitzgerald cwfitzgerald merged commit 2ca7ed9 into gfx-rs:trunk Dec 1, 2025
41 checks passed
@kpreid kpreid deleted the splitfile branch December 1, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants