# Translation Glossary: C++ → Rust This glossary defines consistent mappings from MABE2 / Empirical idioms to MabeLabRS Rust code. It should be updated as the port progresses. ## Memory / Pointers - `std::unique_ptr` → `Box` - `std::shared_ptr` → `Arc` (multi-thread safe), or `Rc` (single-thread) - `std::weak_ptr` → `Weak` (Arc/Rc) - raw pointer (owning) → `Box` - raw pointer (borrowed) → `&T` or `&mut T` ## Optional / Variants - `std::optional` → `Option` - `std::variant` → `enum { A(A), B(B) }` ## Containers - `std::vector` → `Vec` - `std::map` → `BTreeMap` (ordered, deterministic) - `std::unordered_map` → `HashMap` or `IndexMap` (deterministic) - `std::set` → `BTreeSet` ## Interfaces / Inheritance - C++ abstract base class → Rust `trait` - C++ pure virtual function → `fn ...;` in trait - C++ virtual function → default method in trait ## Errors - Error codes / exceptions → `Result` with `thiserror` derive ## Utilities - C++ RNG (emp::Random) → `rand_chacha::ChaCha8Rng` seeded via manifest - Empirical Config → `serde` + `toml/json` - Empirical Signals/Actions → strongly typed Rust event bus (observer pattern)