mirror of https://codeberg.org/topola/topola.git
refactor(specctra/design): avoid double-lookup into net_outs
This commit is contained in:
parent
fc9c8c3396
commit
1879d74fac
|
|
@ -3,7 +3,7 @@
|
||||||
//! exporting the session file
|
//! exporting the session file
|
||||||
|
|
||||||
use geo::{point, Point, Rotate};
|
use geo::{point, Point, Rotate};
|
||||||
use std::collections::HashMap;
|
use std::collections::{hash_map::Entry as HashMapEntry, HashMap};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
board::{mesadata::AccessMesadata, Board},
|
board::{mesadata::AccessMesadata, Board},
|
||||||
|
|
@ -136,12 +136,9 @@ impl SpecctraDesign {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(net) = net_outs.get_mut(&net) {
|
let net_out = match net_outs.entry(net) {
|
||||||
net.wire.push(wire);
|
HashMapEntry::Occupied(occ) => occ.into_mut(),
|
||||||
} else {
|
HashMapEntry::Vacant(vac) => vac.insert(structure::NetOut {
|
||||||
net_outs.insert(
|
|
||||||
net,
|
|
||||||
structure::NetOut {
|
|
||||||
name: mesadata
|
name: mesadata
|
||||||
.net_netname(net)
|
.net_netname(net)
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
|
|
@ -151,11 +148,11 @@ impl SpecctraDesign {
|
||||||
)
|
)
|
||||||
})?
|
})?
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
wire: vec![wire],
|
wire: Vec::new(),
|
||||||
via: Vec::new(),
|
via: Vec::new(),
|
||||||
},
|
}),
|
||||||
);
|
};
|
||||||
}
|
net_out.wire.push(wire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue