Skip to content

refactor!: make PlaneGeometry fields private#75

Merged
shssoichiro merged 2 commits into
rust-av:mainfrom
FreezyLemon:geometry-nonpublic-fields
May 8, 2026
Merged

refactor!: make PlaneGeometry fields private#75
shssoichiro merged 2 commits into
rust-av:mainfrom
FreezyLemon:geometry-nonpublic-fields

Conversation

@FreezyLemon
Copy link
Copy Markdown
Contributor

These should not have been public in the first place. This makes invalid state between geometry and data impossible (fixing any problems related to #61) and results in a nicer API overall.

Basically: Plane and AlignedData have safety invariants that depend on the state of PlaneGeometry when Plane::new is called. By both validating the geometry in its constructor and making it fully immutable, we ensure that the invariants are always fulfilled.

This also means we can remove the re-validation of geometry (part of #74) from Plane::new.

Changes:

  • add getters
  • make getters return zeroable scalars over NonZero. With #[inline] this should elide unnecessary width != 0 checks downstream while making the API simpler (plane.width().get() -> plane.width())
  • move data_origin from Plane to geometry, not something downstream needs without padding awareness (-> -F padding_api)

- add getters
- move data_origin from Plane to geometry
- make getters return simple scalars over NonZero<T>
- remove UB fix from Plane::{new, new_uninit} (categorically impossible now)
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.40%. Comparing base (59bc0dc) to head (d7140e4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #75      +/-   ##
==========================================
- Coverage   99.40%   99.40%   -0.01%     
==========================================
  Files           7        7              
  Lines         668      667       -1     
==========================================
- Hits          664      663       -1     
  Misses          4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shssoichiro shssoichiro merged commit ac83bab into rust-av:main May 8, 2026
11 checks passed
@FreezyLemon FreezyLemon deleted the geometry-nonpublic-fields branch May 8, 2026 10:56
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