Skip to content

feat(api)!: add vertex construction macro#469

Merged
acgetchell merged 1 commit into
mainfrom
feat/466-vertex-macro
Jun 18, 2026
Merged

feat(api)!: add vertex construction macro#469
acgetchell merged 1 commit into
mainfrom
feat/466-vertex-macro

Conversation

@acgetchell

Copy link
Copy Markdown
Owner
  • Add vertex! as a fallible constructor for coordinate-only and data-bearing vertices.
  • Export the macro through the root, construction, and triangulation preludes.
  • Migrate public docs, examples, and benchmark setup to prefer vertex! for incidental vertex construction.
  • Retire the Semgrep rule that banned vertex! and document the new Rust style guidance.

BREAKING CHANGE: Vertex::try_new_with_data now takes data: U instead of impl Into<U>. Callers must pass the exact vertex data type or convert explicitly before construction.

Closes #466

- Add `vertex!` as a fallible constructor for coordinate-only and data-bearing vertices.
- Export the macro through the root, construction, and triangulation preludes.
- Migrate public docs, examples, and benchmark setup to prefer `vertex!` for incidental vertex construction.
- Retire the Semgrep rule that banned `vertex!` and document the new Rust style guidance.

BREAKING CHANGE: `Vertex::try_new_with_data` now takes `data: U` instead of `impl Into<U>`. Callers must pass the exact vertex data type or convert explicitly before construction.

Closes #466
@acgetchell acgetchell self-assigned this Jun 18, 2026
@codacy-production

codacy-production Bot commented Jun 18, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 277 complexity

Metric Results
Complexity 277

View in Codacy

🟢 Coverage 100.00% diff coverage · 0.00% coverage variation

Metric Results
Coverage variation 0.00% coverage variation (-1.00%)
Diff coverage 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (fe3ed92) 69019 63272 91.67%
Head commit (96063b7) 69016 (-3) 63268 (-4) 91.67% (0.00%)

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 (#469) 5 5 100.00%

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%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 8e1742e9-db21-4a8e-bc58-80e2ba562203

📥 Commits

Reviewing files that changed from the base of the PR and between fe3ed92 and 96063b7.

📒 Files selected for processing (60)
  • README.md
  • benches/boundary_uuid_iter.rs
  • benches/common/flip_workflows.rs
  • benches/topology_guarantee_construction.rs
  • docs/api_design.md
  • docs/dev/rust.md
  • docs/dev/tooling-alignment.md
  • docs/diagnostics.md
  • docs/numerical_robustness_guide.md
  • docs/topology.md
  • docs/validation.md
  • docs/workflows.md
  • examples/delaunayize_repair.rs
  • examples/diagnostics.rs
  • examples/into_from_conversions.rs
  • examples/numerical_robustness.rs
  • examples/topology_editing.rs
  • semgrep.yaml
  • src/core/adjacency.rs
  • src/core/algorithms/flips.rs
  • src/core/algorithms/incremental_insertion.rs
  • src/core/algorithms/locate.rs
  • src/core/boundary.rs
  • src/core/collections/key_maps.rs
  • src/core/collections/secondary_maps.rs
  • src/core/construction.rs
  • src/core/edge.rs
  • src/core/facet.rs
  • src/core/query.rs
  • src/core/repair.rs
  • src/core/simplex.rs
  • src/core/tds.rs
  • src/core/traits/boundary_analysis.rs
  • src/core/traits/facet_cache.rs
  • src/core/triangulation.rs
  • src/core/util/deduplication.rs
  • src/core/util/delaunay_validation.rs
  • src/core/util/facet_keys.rs
  • src/core/util/jaccard.rs
  • src/core/validation.rs
  • src/core/vertex.rs
  • src/delaunay/builder.rs
  • src/delaunay/construction.rs
  • src/delaunay/delaunayize.rs
  • src/delaunay/flips.rs
  • src/delaunay/insertion.rs
  • src/delaunay/query.rs
  • src/delaunay/repair.rs
  • src/delaunay/serialization.rs
  • src/delaunay/triangulation.rs
  • src/delaunay/validation.rs
  • src/geometry/algorithms/convex_hull.rs
  • src/geometry/quality.rs
  • src/geometry/util/measures.rs
  • src/lib.rs
  • src/topology/characteristics/euler.rs
  • src/topology/characteristics/validation.rs
  • src/topology/manifold.rs
  • tests/prelude_exports.rs
  • tests/semgrep/src/project_rules/rust_style.rs
💤 Files with no reviewable changes (1)
  • semgrep.yaml

Walkthrough

Introduces a new exported vertex! macro in src/core/vertex.rs that delegates to Vertex::try_new or Vertex::try_new_with_data, changes try_new_with_data to accept data: U directly instead of impl Into<U>, re-exports the macro through three preludes, removes the delaunay.rust.no-vertex-macro Semgrep rule, adds dev-doc guidance, and migrates every example, benchmark, doctest, and Markdown document to use the macro.

Changes

vertex! macro introduction and codebase-wide adoption

Layer / File(s) Summary
vertex! macro definition and try_new_with_data API change
src/core/vertex.rs
New #[macro_export] vertex! macro added with coordinate-only and ; data = … forms delegating to Vertex::try_new/Vertex::try_new_with_data. try_new_with_data signature changes from data: impl Into<U> to data: U; unit test renamed to match.
Prelude re-exports and test coverage
src/lib.rs, tests/prelude_exports.rs
pub use crate::vertex added to prelude, prelude::construction, and prelude::triangulation. New test construction_prelude_covers_vertex_macro exercises macro syntax, data propagation, and the NaN → CoordinateConversionError::NonFiniteValue path.
Semgrep rule removal and dev documentation
semgrep.yaml, tests/semgrep/src/project_rules/rust_style.rs, docs/dev/rust.md, docs/dev/tooling-alignment.md
delaunay.rust.no-vertex-macro rule deleted; fixture function renamed from vertex_macro_bad to vertex_macro_ok. New subsections added: when to use vertex! vs direct constructors, and retired-rule rationale.
Example and benchmark call-site migration
examples/*, benches/*
All examples/ and benches/ files updated to import vertex and use vertex![…]? in place of Vertex::<(), _>::try_new(…)?.
Source file doctest migration
src/core/..., src/delaunay/..., src/geometry/..., src/topology/...
Every /// and //! doc-comment example across all source modules updated to use delaunay::vertex![…]?; src/core/simplex.rs tests also renamed to reflect TDS-backed construction path.
Markdown documentation migration
README.md, docs/api_design.md, docs/diagnostics.md, docs/numerical_robustness_guide.md, docs/topology.md, docs/validation.md, docs/workflows.md
All Markdown code snippets updated to vertex![…]?; README gains explanatory text about the macro's data form and method equivalence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • acgetchell/delaunay#249: Both PRs modify vertex construction in src/core/vertex.rs — that PR removed VertexBuilder, while this one adds the vertex! macro and changes try_new_with_data.
  • acgetchell/delaunay#455: Directly inverted relationship — that PR removed the old vertex! macro in favor of explicit Vertex::try_new constructors; this PR reintroduces a vertex! macro wrapper.

Poem

🐇 Hop hop, the turbofish swims away,
Vertex::<(), _> had too much to say.
Now vertex![x, y, z]? does the trick,
Short, fallible, typed — and oh so slick!
The rabbit stamps docs from README to test,
Of all the macros, vertex! is best. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: introducing a vertex construction macro as a new feature with a breaking API change.
Description check ✅ Passed The description clearly relates to the changeset, explaining the vertex macro addition, prelude exports, migration of docs/examples, retirement of a Semgrep rule, and the breaking change to try_new_with_data.
Linked Issues check ✅ Passed All primary objectives from #466 are met: vertex! macro supports no-data and data-bearing vertices, is exported through root/construction/triangulation preludes, docs/examples are migrated, the Semgrep rule is retired, and try_new_with_data signature is simplified.
Out of Scope Changes check ✅ Passed All changes are directly related to the vertex! macro feature, its export, documentation migration, and the Semgrep rule retirement specified in #466. No unrelated changes detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 100.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/466-vertex-macro

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

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.64%. Comparing base (fe3ed92) to head (96063b7).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
- Coverage   91.64%   91.64%   -0.01%     
==========================================
  Files          72       72              
  Lines       68799    68796       -3     
==========================================
- Hits        63054    63050       -4     
- Misses       5745     5746       +1     
Flag Coverage Δ
unittests 91.64% <100.00%> (-0.01%) ⬇️

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

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

@acgetchell

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@acgetchell
acgetchell merged commit 63228a0 into main Jun 18, 2026
30 of 34 checks passed
@acgetchell
acgetchell deleted the feat/466-vertex-macro branch June 18, 2026 19:52
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.

feat: add ergonomic vertex! and simplex! construction macros

1 participant