Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and refactor dodeca.rs #443

Merged
merged 1 commit into from
Feb 16, 2025

Conversation

patowen
Copy link
Collaborator

@patowen patowen commented Feb 15, 2025

Fixes #381

This PR makes the following changes to the dodeca module:

  • LazyLock is used instead of OnceLock (This change is also made in cursor.rs)
  • Side and Vertex have a VALUES array allowing for easier conversion between integers and enum values
  • VERTEX_COUNT and SIDE_COUNT have been replaced with Vertex::COUNT and Side::COUNT
  • Vertex::from_sides now takes in an array instead of 3 separate parameters for consistency with Vertex::canonical_sides
  • Arrays are now initialized to their final values when it makes sense to do so (instead of being initialized to a dummy value and then filled in). This utilizes array::from_fn and array::map in various places.
  • Complicated math is better explained in code comments
  • Some implementations are replaced with simpler implementations, such as is_facing, ADJACENT, and SIDES_TO_VERTEX

Changes in other modules are for compatibility with the changes to dodeca.

@patowen patowen requested a review from Ralith February 15, 2025 23:59
common/src/dodeca.rs Outdated Show resolved Hide resolved
@patowen patowen force-pushed the document-and-modernize-dodeca branch from 0dbb404 to 3d75040 Compare February 16, 2025 02:56
@Ralith Ralith force-pushed the document-and-modernize-dodeca branch from 3d75040 to c217285 Compare February 16, 2025 07:11
common/src/dodeca.rs Outdated Show resolved Hide resolved
common/src/dodeca.rs Outdated Show resolved Hide resolved
common/src/dodeca.rs Outdated Show resolved Hide resolved
@patowen patowen force-pushed the document-and-modernize-dodeca branch 2 times, most recently from a9aa284 to f73a3d1 Compare February 16, 2025 19:30
@patowen patowen force-pushed the document-and-modernize-dodeca branch from f73a3d1 to 49bd68c Compare February 16, 2025 20:23
@patowen patowen enabled auto-merge (rebase) February 16, 2025 20:24
@patowen patowen merged commit cdda5f0 into Ralith:master Feb 16, 2025
4 checks passed
@patowen patowen deleted the document-and-modernize-dodeca branch February 16, 2025 20:33
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.

Modernize Rust idioms
2 participants