diff --git a/substrate/src/layout/cell.rs b/substrate/src/layout/cell.rs index 8aec843..4b7a95f 100644 --- a/substrate/src/layout/cell.rs +++ b/substrate/src/layout/cell.rs @@ -1007,6 +1007,21 @@ impl CellPort { } } + pub fn with_shapes( + id: impl Into, + layer: LayerKey, + shapes: impl IntoIterator, + ) -> Self { + let mut map = HashMap::with_capacity(1); + let mut entry = map.entry(layer).or_insert_with(Vec::new); + entry.extend(shapes); + Self { + id: id.into(), + shapes: map, + must_connect: Default::default(), + } + } + pub fn with_element(id: impl Into, elem: Element) -> Self { let mut shapes = HashMap::with_capacity(1); shapes.insert(elem.layer.layer(), vec![elem.into_inner()]); @@ -1037,6 +1052,11 @@ impl CellPort { self } + pub fn must_connect(mut self, must_connect: impl Into) -> Self { + self.set_must_connect(must_connect); + self + } + /// Returns the ID of the port. #[inline] pub fn id(&self) -> &PortId {