#pcb #gerber #cad #cam #rs274x

gerber-types

Types and code generation for Gerber files (RS-274X)

8 releases (breaking)

0.7.0 Dec 19, 2025
0.6.0 Jul 11, 2025
0.5.0 Jul 10, 2025
0.4.0 Jun 30, 2025
0.1.1 Jun 10, 2017

#287 in Rust patterns

Download history 38/week @ 2025-10-16 20/week @ 2025-10-23 9/week @ 2025-10-30 5/week @ 2025-11-06 3/week @ 2025-11-13 19/week @ 2025-11-20 14/week @ 2025-11-27 13/week @ 2025-12-04 12/week @ 2025-12-11 46/week @ 2025-12-18 14/week @ 2025-12-25 144/week @ 2026-01-01 19/week @ 2026-01-08 9/week @ 2026-01-15 6/week @ 2026-01-22 9/week @ 2026-01-29

53 downloads per month
Used in 6 crates (4 directly)

MIT/Apache

215KB
5K SLoC

Rust Gerber Library

Build status Crates.io MakerPnP Discord

This crate implements the basic building blocks of Gerber X2 (compatible with Gerber RS-274X) code. It focuses on the low-level types (to be used like an AST) and code generation and does not do any semantic checking.

For example, you can use an aperture without defining it. This will generate syntactically valid but semantically invalid Gerber code, but this module won't complain.

Current Gerber X2 spec: gerber-layer-format-specification-revision-2024-05_en.pdf

Example

You can find an example in the examples directory.

This library has a low-level focus and is quite verbose. Other external crates can provide a high-level API.

To generate Gerber code for that example:

$ cargo run --example polarities-apertures

Gerber Parser

A rust crate for parsing gerber files that uses this crate as a dependency:

Crates.io: https://crates.io/crates/gerber-parser Github: https://github.com/MakerPnP/gerber-parser

Gerber Viewer

A rust crate for rendering gerber layers, also uses this crate as a dependency:

Github: https://github.com/MakerPnP/gerber-viewer

For a list of other projects that use this crate you can check the github 'dependents' page.

https://github.com/MakerPnP/gerber-types/network/dependents

Authors

  • Danilo Bargen - Original author.
  • Dominic Clifton - Current maintainer (2025/05/05 onwards).

See the contributors page on github for full list.

License

Licensed under either of the following licenses, at your option.

Dependencies

~1.7–2.4MB
~45K SLoC