Skip to main content

klayout_core/
lib.rs

1//! `klayout-core` — the foundation data model for klayout-rs.
2//!
3//! This crate defines coordinates, geometry primitives (data only), layers,
4//! cells, ports, instances, and the parameterized-component machinery.
5//! Everything else in the workspace — IO, geometry algorithms, routing,
6//! DRC/LVS — sits on top of these types and is expected to honor the
7//! invariants documented per-module.
8//!
9//! Design contract:
10//! 1. Frozen cells are immutable. All mutation goes through `CellBuilder`.
11//! 2. `ContentHash` is deterministic, structural, byte-stable across runs.
12//! 3. All coordinates are i64 DBU. Microns are a thin conversion layer.
13//! 4. `Library` is `Send + Sync`; concurrent `build`/`insert` is safe.
14//! 5. `CellId` / `LayerIndex` are meaningful only with their issuing library.
15//! 6. No global state. `BuildCtx` is passed.
16
17pub mod bus;
18pub mod cell;
19pub mod component;
20pub mod coord;
21pub mod edit;
22pub mod error;
23pub mod hash;
24pub mod instance;
25pub mod layer;
26pub mod layermap;
27pub mod library;
28pub mod port;
29pub mod properties;
30pub mod query;
31pub mod shape;
32
33pub use bus::{format_bus_pin, parse_bus, Bus, BusBitChars, BusName};
34pub use cell::{Cell, CellBuilder, CellId, CellName, ShapeBag};
35pub use component::{BuildCtx, Component};
36pub use edit::{clip_cell, flatten, local_bbox, remap_layers, replace_instances, LayerMap};
37pub use coord::{Bbox, DTrans, Point, Rot4, Trans, Vec2};
38pub use error::{CoreError, Result};
39pub use hash::{ContentHash, ParamHash, ParamHasher};
40pub use instance::{Instance, Repetition, SourceTag};
41pub use layer::{LayerIndex, LayerInfo, LayerTable};
42pub use layermap::{parse_layermap, write_layermap, LayerMapEntry, LayerMapError, LayerMapping};
43pub use library::Library;
44pub use port::{Angle90, Port, PortKindId};
45pub use properties::{Properties, PropertyValue};
46pub use query::{HierarchyVisitor, InstanceRef, LayoutQuery, ShapeRef, Visit};
47pub use shape::{HAlign, Path, PathCap, Polygon, Rect, Shape, Text, VAlign};