Skip to content

Restrict visibility of Elements backing-store fields and add targeted accessors #29

Description

@coderabbitai

Summary

The Elements struct in crates/fynix/src/element/storage.rs currently exposes its backing stores (elements, metas, type_metas) as pub fields. This allows callers to mutate the three stores independently and break the invariants that add, remove, render, and layout rely on.

Suggested Fix

  • Change the visibility of elements, metas, and type_metas to pub(crate) (or fully private).
  • Add minimal, targeted accessors or iterator methods (e.g., Elements::get_element, Elements::iter_elements, Elements::get_meta, Elements::get_type_meta) that return immutable references or controlled mutation APIs.
  • Ensure all mutations continue to go through the existing add/remove APIs so invariants are preserved.
  • Update any call sites to use the new accessors.

Context

Identified during review of PR #28 (Storage split refactor): #28 (comment)

Deferred from that PR as out of scope.

/cc @nixonyh

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions