Use pointers for indexing elements by ID
This commit is contained in:
parent
ab01c26415
commit
5191534886
1 changed files with 2 additions and 2 deletions
|
@ -446,7 +446,7 @@ pub struct Assembly {
|
||||||
pub tangent: Signal<ConfigSubspace>,
|
pub tangent: Signal<ConfigSubspace>,
|
||||||
|
|
||||||
// indexing
|
// indexing
|
||||||
pub elements_by_id: Signal<FxHashMap<String, ElementKey>>
|
pub elements_by_id: Signal<FxHashMap<String, Rc<dyn Element>>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Assembly {
|
impl Assembly {
|
||||||
|
@ -469,7 +469,7 @@ impl Assembly {
|
||||||
let id = elt.id().clone();
|
let id = elt.id().clone();
|
||||||
let elt_rc = Rc::new(elt);
|
let elt_rc = Rc::new(elt);
|
||||||
let key = self.elements.update(|elts| elts.insert(elt_rc.clone())); /* KLUDGE */ // reorganize to avoid cloning?
|
let key = self.elements.update(|elts| elts.insert(elt_rc.clone())); /* KLUDGE */ // reorganize to avoid cloning?
|
||||||
self.elements_by_id.update(|elts_by_id| elts_by_id.insert(id, key));
|
self.elements_by_id.update(|elts_by_id| elts_by_id.insert(id, elt_rc.clone())); /* KLUDGE */ // reorganize to avoid cloning?
|
||||||
|
|
||||||
// create and insert the element's default regulators
|
// create and insert the element's default regulators
|
||||||
for reg in elt_rc.default_regulators(&self) {
|
for reg in elt_rc.default_regulators(&self) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue