Expand description
klayout-core — the foundation data model for klayout-rs.
This crate defines coordinates, geometry primitives (data only), layers, cells, ports, instances, and the parameterized-component machinery. Everything else in the workspace — IO, geometry algorithms, routing, DRC/LVS — sits on top of these types and is expected to honor the invariants documented per-module.
Design contract:
- Frozen cells are immutable. All mutation goes through
CellBuilder. ContentHashis deterministic, structural, byte-stable across runs.- All coordinates are i64 DBU. Microns are a thin conversion layer.
LibraryisSend + Sync; concurrentbuild/insertis safe.CellId/LayerIndexare meaningful only with their issuing library.- No global state.
BuildCtxis passed.
Re-exports§
pub use bus::format_bus_pin;pub use bus::parse_bus;pub use bus::Bus;pub use bus::BusBitChars;pub use bus::BusName;pub use cell::Cell;pub use cell::CellBuilder;pub use cell::CellId;pub use cell::CellName;pub use cell::ShapeBag;pub use component::BuildCtx;pub use component::Component;pub use edit::clip_cell;pub use edit::flatten;pub use edit::local_bbox;pub use edit::remap_layers;pub use edit::replace_instances;pub use edit::LayerMap;pub use coord::Bbox;pub use coord::DTrans;pub use coord::Point;pub use coord::Rot4;pub use coord::Trans;pub use coord::Vec2;pub use error::CoreError;pub use error::Result;pub use hash::ContentHash;pub use hash::ParamHash;pub use hash::ParamHasher;pub use instance::Instance;pub use instance::Repetition;pub use instance::SourceTag;pub use layer::LayerIndex;pub use layer::LayerInfo;pub use layer::LayerTable;pub use layermap::parse_layermap;pub use layermap::write_layermap;pub use layermap::LayerMapEntry;pub use layermap::LayerMapError;pub use layermap::LayerMapping;pub use library::Library;pub use port::Angle90;pub use port::Port;pub use port::PortKindId;pub use properties::Properties;pub use properties::PropertyValue;pub use query::HierarchyVisitor;pub use query::InstanceRef;pub use query::LayoutQuery;pub use query::ShapeRef;pub use query::Visit;pub use shape::HAlign;pub use shape::Path;pub use shape::PathCap;pub use shape::Polygon;pub use shape::Rect;pub use shape::Shape;pub use shape::Text;pub use shape::VAlign;
Modules§
- bus
- Bus-pin name parsing and expansion.
- cell
- Cells: frozen, immutable artifacts produced by freezing a
CellBuilder. - component
- Components: parameterized cell factories with deterministic param hashing.
- coord
- Integer coordinates and exact orthogonal transforms.
- edit
- Hierarchy editing primitives.
- error
- Error types. Every error carries the cell context where possible so that sign-off-grade reports can be assembled without losing provenance.
- hash
- Content-addressable hashing for cells and component params.
- instance
- Instance: placement of a child cell with a transform, optional repetition, and provenance.
- layer
- Layers: local indexing inside a Library, GDS (layer, datatype) backing.
- layermap
- Layer mapping file (.layermap / .map / .lyp shorthand).
- library
- Library: top-level container.
- port
- Ports: typed connection points on a cell.
- properties
- Generic typed key-value store for round-tripping GDS/OASIS user properties and tagging Component build args on cells.
- query
- Iteration and spatial-query traits. The core ships naive linear-scan
impls on
Library/Cell;klayout-geomwill layer R-trees underneath without changing this surface. - shape
- Geometry primitives, as data only.