Skip to content

Changed: Removes CoordinateScalar bound from Cell, Tds, Vertex#193

Merged
acgetchell merged 2 commits intomainfrom
refactor/tds-combinatorial
Feb 8, 2026
Merged

Changed: Removes CoordinateScalar bound from Cell, Tds, Vertex#193
acgetchell merged 2 commits intomainfrom
refactor/tds-combinatorial

Conversation

@acgetchell
Copy link
Owner

Relaxes trait bounds on Cell, Tds, and Vertex structs by removing the CoordinateScalar requirement.

This change prepares the triangulation data structure for combinatorial operations independent of geometry. The validate method in Tds now requires CoordinateScalar to perform coordinate validation, where applicable. (Internal change).

Relaxes trait bounds on `Cell`, `Tds`, and `Vertex` structs by
removing the `CoordinateScalar` requirement.

This change prepares the triangulation data structure for combinatorial
operations independent of geometry. The `validate` method in `Tds`
now requires `CoordinateScalar` to perform coordinate validation,
where applicable. (Internal change).
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

Walkthrough

Removed the T: CoordinateScalar generic bound from several core types (Cell, Vertex, Tds, Point), moving coordinate-related constraints to specific impls or methods (e.g., Tds::validate) where needed.

Changes

Cohort / File(s) Summary
Cell
src/core/cell.rs
Dropped T: CoordinateScalar from Cell struct and all impls/trait impls (Serialize, Deserialize, PartialEq/Ord, Eq, Hash). Serialization/deserialization visitors and signatures updated accordingly.
Vertex
src/core/vertex.rs
Removed T: CoordinateScalar from Vertex struct. Added an inherent impl<T, U, const D: usize> Vertex<T, U, D> where U: DataType exposing uuid(), dim(), and point() accessors (moved from prior impl).
TDS (Triangulation)
src/core/triangulation_data_structure.rs
Removed T: CoordinateScalar from Tds type/impl; added where T: CoordinateScalar to validate() so coordinate checks require the bound while structural validation does not.
Point (geometry)
src/geometry/point.rs
Removed T: CoordinateScalar bound from Point struct declaration, shifting coordinate trait enforcement to impl blocks rather than the type signature.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I nudged the bounds and set types free,
Points, Cells, and Vertices hopping with glee.
Validate keeps watch where coordinates play,
While generics wander out to the day.
Hooray — new paths for code to see! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing CoordinateScalar bounds from Cell, Tds, and Vertex structs, which is the primary focus of the changeset across all modified files.
Description check ✅ Passed The description clearly relates to the changeset by explaining the purpose of relaxing trait bounds on Cell, Tds, and Vertex, and noting that validate() now requires CoordinateScalar, which aligns with the actual code changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/tds-combinatorial

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/core/vertex.rs (1)

569-569: is_valid consumes self — consider taking &self instead.

is_valid takes ownership of the vertex, which means callers must clone/copy before validating if they still need the vertex. Since the method only reads fields, &self would be more ergonomic and consistent with the borrowed-API guideline. This is pre-existing behavior but worth addressing while you're refactoring this area.

♻️ Suggested change
-    pub fn is_valid(self) -> Result<(), VertexValidationError>
+    pub fn is_valid(&self) -> Result<(), VertexValidationError>

As per coding guidelines, **/*.rs: "Prefer borrowed APIs by default: take references (&T, &mut T, &[T]) as arguments and return borrowed views (&T, &[T]) when possible."


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added geometry Geometry-related issues rust Pull requests that update rust code labels Feb 8, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/core/vertex.rs (1)

170-173: ⚠️ Potential issue | 🟡 Minor

Stale doc: struct no longer requires T: CoordinateScalar.

The struct's where clause (line 186) now only requires U: DataType, but the doc still states "T must implement CoordinateScalar". Consider rewording to reflect that CoordinateScalar is required only for specific operations (serialization, validation, geometric methods), not at the type level.

📝 Suggested doc update
 /// # Constraints
 ///
-/// - `T` must implement `CoordinateScalar` (floating-point operations, validation, etc.)
+/// - `T` must implement `CoordinateScalar` for geometric operations, validation, and serialization
+///   (the struct itself does not require it, enabling purely combinatorial use)
 /// - `U` must implement `DataType` (serialization, equality, hashing, etc.)
🧹 Nitpick comments (1)
src/core/vertex.rs (1)

504-507: Consider moving point() to the relaxed impl block.

point() is a pure field accessor (returns &self.point) with no dependency on CoordinateScalar. Moving it alongside uuid() and dim() in the relaxed where U: DataType block at line 207 would further the PR's goal of enabling combinatorial access without requiring coordinate-scalar bounds.

♻️ Suggested move
 impl<T, U, const D: usize> Vertex<T, U, D>
 where
     U: DataType,
 {
     /// Returns the UUID of the vertex.
     #[inline]
     pub const fn uuid(&self) -> Uuid {
         self.uuid
     }
 
     /// Returns the spatial dimension of the vertex.
     #[inline]
     pub const fn dim(&self) -> usize {
         D
     }
+
+    /// Returns the point coordinates of the vertex.
+    #[inline]
+    pub const fn point(&self) -> &Point<T, D> {
+        &self.point
+    }
 }

And remove point() from the T: CoordinateScalar impl block.

@codacy-production
Copy link

codacy-production bot commented Feb 8, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.02% (target: -1.00%) 85.71%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (fe3e406) 10126 6380 63.01%
Head commit (e3c2324) 10126 (+0) 6382 (+2) 63.03% (+0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#193) 7 6 85.71%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.05%. Comparing base (fe3e406) to head (e3c2324).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/core/vertex.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #193      +/-   ##
==========================================
+ Coverage   63.03%   63.05%   +0.01%     
==========================================
  Files          46       46              
  Lines       10119    10119              
==========================================
+ Hits         6379     6381       +2     
+ Misses       3740     3738       -2     
Flag Coverage Δ
unittests 63.05% <85.71%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Clarifies the `Vertex` struct's constraints, emphasizing
`CoordinateScalar` requirement for geometric operations and
serialization but allowing combinatorial use without it.

Moves the `point` method definition to ensure consistent API
presentation. (Internal refactoring, no functional change).

Refs: refactor/tds-combinatorial
@acgetchell acgetchell merged commit e69f3d1 into main Feb 8, 2026
11 of 12 checks passed
@acgetchell acgetchell deleted the refactor/tds-combinatorial branch February 8, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

geometry Geometry-related issues rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant