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
Summary
The
Elementsstruct incrates/fynix/src/element/storage.rscurrently exposes its backing stores (elements,metas,type_metas) aspubfields. This allows callers to mutate the three stores independently and break the invariants thatadd,remove,render, andlayoutrely on.Suggested Fix
elements,metas, andtype_metastopub(crate)(or fully private).Elements::get_element,Elements::iter_elements,Elements::get_meta,Elements::get_type_meta) that return immutable references or controlled mutation APIs.add/removeAPIs so invariants are preserved.Context
Identified during review of PR #28 (Storage split refactor): #28 (comment)
Deferred from that PR as out of scope.
/cc @nixonyh