Skip to content

Conversation

@krakow10
Copy link
Contributor

@krakow10 krakow10 commented Dec 2, 2025

Why does MaterialColors use a BTreeMap? The entire data structure [Color3uint8;21] (63 bytes) can fit into a Variant (64 bytes) on the stack. The FromIterator and IntoIterator stuff added here is neat, but the serde implementation is no longer derivable.

Notes:

  • The Default trait is implemented manually, it cannot be derived
  • The public interface is changed: From<T:Into<BTreeMap>> is no longer supported, but FromIterator<(TerrainMaterials, Color3uint8)> can be used instead, and arguably should have been used in the first place.
  • IntoIterator is implemented for both MaterialColors and &MaterialColors for convenience

@krakow10 krakow10 changed the title Refactor MaterialColors Refactor MaterialColors to Array Dec 2, 2025
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.

1 participant