Use pointers to refer to elements and regulators #84

Merged
glen merged 10 commits from Vectornaut/dyna3:use-pointers into main 2025-05-06 19:17:31 +00:00

10 commits

Author SHA1 Message Date
Aaron Fenyes
f9ff1c0f43 Update continuous integration image to Rust 1.86
All checks were successful
/ test (pull_request) Successful in 3m12s
2025-05-06 10:27:03 -07:00
Aaron Fenyes
3dd6303e99 Update assembly tests to use pointers
Some checks failed
/ test (pull_request) Failing after 13s
2025-05-05 21:26:02 -07:00
Aaron Fenyes
501cd74c96 Use B-tree collections instead of Fx hash ones
This removes a dependency. Since the collections in question should
usually be pretty small, it might also reduce memory overhead at little
cost in speed. Here are some relevant performance discussions:

  https://users.rust-lang.org/t/hashmap-vs-btreemap/13804
  https://www.reddit.com/r/rust/comments/7rgowj/hashmap_vs_btreemap/
2025-05-04 12:49:35 -07:00
Aaron Fenyes
c6b628d424 Store elements and regulators without keys
Since we're no longer using storage keys to refer to elements and
regulators, we don't need to store these items in keyed collections
anymore.

To keep element and regulator pointers in `BTreeSet` collections, we
implement `Ord` for `Serial` trait objects. As a bonus, this lets us
turn the element-wise regulator collections back into `BTreeSet`.
2025-05-04 12:32:37 -07:00
Aaron Fenyes
8a86038de0 Use pointers, not keys, to refer to regulators
In the process, move the code that used to handle serial numbering for
elements into the `Serial` trait, where it can provide serial numbers
for regulators too.
2025-05-04 10:59:28 -07:00
Aaron Fenyes
fbd6177a07 Drop unused context
Using pointers to refer to elements reduces the need to drag context
around.
2025-05-04 01:19:00 -07:00
Aaron Fenyes
5191534886 Use pointers for indexing elements by ID 2025-05-04 00:24:31 -07:00
Aaron Fenyes
ab01c26415 Use pointers, not keys, to refer to elements
Use reference-counted pointers, rather than collection keys, to refer to
elements in tasks like specifying the subjects of regulators, handling
selection, and creating interface components.
2025-05-04 00:09:30 -07:00
Aaron Fenyes
17f30d1312 Compare elements by serial number, not address
Rust pointers don't seem to be designed for use as identifiers, so it's
probably more idiomatic and possibly more reliable to manage our own
unique identifier system.

  https://stackoverflow.com/a/72149089

This also lets us get rid of the `ElementRc` newtype.
2025-05-03 00:08:17 -07:00
Aaron Fenyes
347981201c Use select for click selection in outline
This gets rid of duplicated code.
2025-05-02 14:51:51 -07:00