refactor!: make PlaneGeometry fields private#75
Merged
Conversation
- 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
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::newis 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:
#[inline]this should elide unnecessarywidth != 0checks downstream while making the API simpler (plane.width().get()->plane.width())-F padding_api)