Skip to content

Add common traits for many (but not all) structs#11

Merged
alexespencer merged 3 commits into
mainfrom
asp/traits
May 31, 2025
Merged

Add common traits for many (but not all) structs#11
alexespencer merged 3 commits into
mainfrom
asp/traits

Conversation

@alexespencer
Copy link
Copy Markdown
Owner

No description provided.

@alexespencer alexespencer requested a review from Copilot May 31, 2025 17:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends several core structs with common trait derives, refactors the Point type to use OrderedFloat for total ordering, and adapts related code for those changes.

  • Derive Clone, Debug, and PartialEq on DistanceQuery, QuadTree, and other types.
  • Refactor Point to wrap its coordinates in OrderedFloat, add Display, Default, and manual (de)serialization support.
  • Update Region::contains and other call sites to work with the new Point::dimension_values API.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
quadtree/src/region.rs Updated contains to pass a reference to values now returned by array.
quadtree/src/query.rs Added #[derive(Clone, Debug)] to DistanceQuery.
quadtree/src/quadtree.rs Added #[derive(Clone, PartialEq, Debug)] to QuadTree.
quadtree/src/point.rs Switched from [f64; N] to [OrderedFloat<f64>; N], implemented Display, Default, and manual serdev (de)serialization, and adjusted APIs.
quadtree/Cargo.toml Added dependencies on ordered-float, serdev, and test-only serde_json.
Comments suppressed due to low confidence (1)

quadtree/src/region.rs:38

  • The change to pass a reference here isn't covered by existing tests. Consider adding unit tests for Region::contains with points inside and outside various intervals.
.all(|(interval, value)| interval.contains(&value))

Comment thread quadtree/src/point.rs
Comment thread quadtree/src/point.rs Outdated
Comment thread quadtree/src/point.rs
@alexespencer alexespencer merged commit 9f3c624 into main May 31, 2025
1 check passed
@alexespencer alexespencer deleted the asp/traits branch May 31, 2025 17:57
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