laykit/
lib.rs

1//! # laykit - GDSII and OASIS File Format Library
2//!
3//! A production-ready Rust library for reading, writing, and converting between
4//! GDSII and OASIS file formats used in integrated circuit layout design.
5//!
6//! ## Features
7//!
8//! - **Full GDSII Support** - Read and write `.gds` files with all element types
9//! - **Full OASIS Support** - Read and write `.oas` files with all element types
10//! - **Format Conversion** - Convert between GDSII and OASIS formats
11//! - **Streaming Parser** - Process large files without loading into memory
12//! - **CLI Tool** - Command-line utility for file operations
13//! - **Property Utilities** - Enhanced property management and builders
14//! - **AREF Expansion** - Array reference expansion utilities
15//! - **Zero Dependencies** - Pure Rust implementation using only `std`
16//! - **Memory Safe** - Leverages Rust's ownership system
17//! - **Production Ready** - Comprehensive test suite with 53 tests
18//!
19//! ## Quick Start
20//!
21//! ### Reading a GDSII File
22//!
23//! ```no_run
24//! use laykit::GDSIIFile;
25//!
26//! let gds = GDSIIFile::read_from_file("layout.gds")?;
27//! println!("Library: {}", gds.library_name);
28//! println!("Structures: {}", gds.structures.len());
29//! # Ok::<(), Box<dyn std::error::Error>>(())
30//! ```
31//!
32//! ### Creating a GDSII File
33//!
34//! ```
35//! use laykit::{GDSIIFile, GDSStructure, GDSTime, GDSElement, Boundary};
36//!
37//! let mut gds = GDSIIFile::new("MY_LIBRARY".to_string());
38//! gds.units = (1e-6, 1e-9); // 1 micron user unit, 1nm database unit
39//!
40//! let mut structure = GDSStructure {
41//!     name: "TOP".to_string(),
42//!     creation_time: GDSTime::now(),
43//!     modification_time: GDSTime::now(),
44//!     strclass: None,
45//!     elements: Vec::new(),
46//! };
47//!
48//! structure.elements.push(GDSElement::Boundary(Boundary {
49//!     layer: 1,
50//!     datatype: 0,
51//!     xy: vec![(0, 0), (1000, 0), (1000, 1000), (0, 1000), (0, 0)],
52//!     elflags: None,
53//!     plex: None,
54//!     properties: Vec::new(),
55//! }));
56//!
57//! gds.structures.push(structure);
58//! ```
59//!
60//! ### Reading an OASIS File
61//!
62//! ```no_run
63//! use laykit::OASISFile;
64//!
65//! let oasis = OASISFile::read_from_file("layout.oas")?;
66//! println!("Cells: {}", oasis.cells.len());
67//! # Ok::<(), Box<dyn std::error::Error>>(())
68//! ```
69//!
70//! ### Format Conversion
71//!
72//! ```no_run
73//! use laykit::{GDSIIFile, converter};
74//!
75//! // Convert GDSII to OASIS
76//! let gds = GDSIIFile::read_from_file("input.gds")?;
77//! let oasis = converter::gdsii_to_oasis(&gds)?;
78//! oasis.write_to_file("output.oas")?;
79//! # Ok::<(), Box<dyn std::error::Error>>(())
80//! ```
81//!
82//! ## Modules
83//!
84//! - [`gdsii`] - GDSII format support
85//! - [`oasis`] - OASIS format support
86//! - [`converter`] - Format conversion utilities
87//! - [`streaming`] - Streaming parser for large files
88//! - [`properties`] - Property management utilities
89//! - [`aref_expansion`] - Array reference expansion tools
90//! - [`format_detection`] - File format detection by magic bytes
91
92pub mod aref_expansion;
93pub mod converter;
94pub mod format_detection;
95pub mod gdsii;
96pub mod oasis;
97pub mod properties;
98pub mod streaming;
99
100pub use aref_expansion::*;
101pub use gdsii::*;
102pub use oasis::*;
103pub use properties::*;
104pub use streaming::*;