Vectornaut
e917272c60
Give each `Element` a serial number, which identifies it uniquely. The serial number is assigned by the `Element::new` constructor. Because disallows potentially unsafe global state (at least without explicit `unsafe` blocks), the next serial number is stored in a thread-safe static atomic variable (`assembly::NEXT_ELEMENT_SERIAL`), as suggested in [this StackOverflow answer](https://stackoverflow.com/a/32936288). Since the overhead for keeping track of memory ordering should be minimal, we're using the strongest available ordering: [sequentially consistent](https://marabos.nl/atomics/memory-ordering.html#seqcst). Resolves #20. Co-authored-by: Aaron Fenyes <aaron.fenyes@fareycircles.ooo> Reviewed-on: #22 Co-authored-by: Vectornaut <vectornaut@nobody@nowhere.net> Co-committed-by: Vectornaut <vectornaut@nobody@nowhere.net> |
||
---|---|---|
.. | ||
src | ||
.gitignore | ||
Cargo.toml | ||
index.html | ||
main.css | ||
run-examples |