Crates.io | nom_stl |
lib.rs | nom_stl |
version | 0.2.2 |
source | src |
created_at | 2020-11-05 21:45:25.184535 |
updated_at | 2021-03-15 16:29:39.069595 |
description | A fast STL parser |
homepage | https://github.com/fast-radius/nom_stl |
repository | https://github.com/fast-radius/nom_stl |
max_upload_size | |
id | 309011 |
size | 35,728 |
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.
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.
$ 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
$ cargo bench
Attribution and thanks goes to the following people for licensing their files Creative Commons so we could include them in this project: