pheon/README.md

1.6 KiB

klamath-rs

A fast GDSII parser and writer in Rust, with Apache Arrow integration for efficient data handling.

Overview

klamath-rs is designed to handle large GDSII files with high performance. It uses Apache Arrow as its primary in-memory data representation, allowing for efficient memory usage and easy integration with other tools in the Arrow ecosystem (like pandas, polars, or DuckDB via Python bindings).

Documentation

Features

  • Fast parsing of GDSII files.
  • Efficient memory representation using Apache Arrow.
  • Support for common GDSII elements: SREF, AREF, Boundary, Path, Text, etc.
  • Optimized "batch" representations for rectangles and boundaries sharing the same layer.
  • C-compatible FFI for integration with other languages (e.g., Python).

Usage

read_path exports a library through the Arrow C Data Interface. Allocate initialized ArrowArray and ArrowSchema output structures, then check the returned status: 0 means success and -1 means failure. Only import the Arrow outputs after success; the caller owns their release callbacks. Failed calls leave the outputs unchanged. See test.py for a Python CFFI example.

last_error_message() returns a UTF-8, null-terminated error string, or null after a successful parser call. Errors belong to the calling thread. Copy the message before making another parser call on that thread, and before the thread exits; calls on other threads do not invalidate it. Parser panics that unwind are converted into errors.