nom_stl

CircleCI

What

nom_stl is a binary and ASCII STL parser, written in pure Rust, with only one runtime dependency: the nom parser combinator library. nom_stl automatically differentiates between ASCII and binary STLs. It parses a 30M binary STL in <20ms.

Use

rust let file = std::fs::File::open("./fixtures/Root_Vase.stl").unwrap(); let mut root_vase = BufReader::new(&file); let mesh: Mesh = parse_stl(&mut root_vase)?; assert_eq!(mesh.triangles.len(), 596_736);

nom_stl accepts STL bytes in a wide variety of argument formats: it will try to parse any collection of bytes that implements Read and Seek.

Running the tests

$ cargo test

To make the tests run faster (but increase build time), you can run the tests in release mode. To do this, run the following:

$ cargo test --release

Running the benchmarks

$ cargo bench

What does it need

Creative Commons

Attribution and thanks goes to the following people for licensing their files Creative Commons so we could include them in this project: