Core data model for the klayout-rs
workspace: coordinates, shapes, cells, libraries, layers, ports,
transformations, and the parameterized-component machinery every other
crate is built on.
| Module | Contents |
|---|---|
coord |
DBU integer coordinates, Point, Vec2, Bbox, Trans, Rot4. |
shape |
Shape, Polygon, Path, Rect, Text and friends — data only. |
cell |
Immutable Cell, CellBuilder, ShapeBag, content-hashed CellId. |
library |
Library: thread-safe interner of cells + layer table. |
layer |
LayerIndex, LayerInfo, LayerTable. |
port |
Typed Port, PortKindId, Angle90. |
instance |
Instance, Repetition arrays, SourceTag provenance. |
component |
Parameterized cell generation via Component + BuildCtx. |
edit |
flatten, clip_cell, remap_layers, replace_instances. |
query |
LayoutQuery, HierarchyVisitor for read-only traversal. |
hash |
Deterministic structural ContentHash and ParamHash. |
properties |
Properties map for user-defined per-shape/cell metadata. |
bus |
Bus-name parser/formatter for synthesis-style pin lists. |
error |
CoreError and Result. |
- Frozen cells are immutable. All mutation goes through
CellBuilder. ContentHashis deterministic, structural, and byte-stable across runs.- All coordinates are
i64DBU. Microns are a thin conversion layer. LibraryisSend + Sync; concurrentbuild/insertis safe.CellId/LayerIndexare meaningful only with their issuing library.- No global state.
BuildCtxis passed.
use klayout_core::{Library, Polygon, Point, Shape};
let lib = Library::new("demo");
let m1 = lib.layer(klayout_core::LayerInfo::named("M1", 1, 0));
let mut cell = lib.builder("top");
cell.add(m1, Shape::Polygon(Polygon::rect(0, 0, 1000, 500)));
let top = cell.freeze();Licensed under GPL-3.0-only.