#mesh #3d-mesh #stl #3d #ascii

stl_io

STL input and output for reading and writing STL (STereoLithography) files

27 releases

Uses new Rust 2024

0.11.0 Mar 15, 2026
0.10.0 Nov 9, 2025
0.9.0 Nov 9, 2025
0.8.5 Feb 26, 2025
0.3.3 Jul 5, 2017

#27 in Graphics APIs

Download history 77749/week @ 2026-01-15 87040/week @ 2026-01-22 97891/week @ 2026-01-29 86052/week @ 2026-02-05 100540/week @ 2026-02-12 105372/week @ 2026-02-19 103374/week @ 2026-02-26 90724/week @ 2026-03-05 84858/week @ 2026-03-12 89330/week @ 2026-03-19 95835/week @ 2026-03-26 91977/week @ 2026-04-02 106591/week @ 2026-04-09 92769/week @ 2026-04-16 99533/week @ 2026-04-23 76907/week @ 2026-04-30

396,714 downloads per month
Used in 72 crates (36 directly)

MIT license

34KB
689 lines

stl_io

test workflow build workflow Cargo License: MIT Downloads

stl_io is crate for reading and writing STL (STereoLithography) files. It can read both, binary and ascii STL in a safe manner. Writing is limited to binary STL, which is more compact anyway.

Examples

Read STL file:

use std::fs::OpenOptions;
let mut file = OpenOptions::new().read(true).open("mesh.stl").unwrap();
let stl = stl_io::read_stl(&mut file).unwrap();

Write STL file:

use std::fs::OpenOptions;
let mesh = [stl_io::Triangle { normal: [1.0, 0.0, 0.0],
                               vertices: [[0.0, -1.0, 0.0],
                                          [0.0, 1.0, 0.0],
                                          [0.0, 0.0, 0.5]]}];
let mut file = OpenOptions::new().write(true).create_new(true).open("mesh.stl").unwrap();
stl_io::write_stl(&mut file, mesh.iter()).unwrap();

For more information, check out the Documentation.

License

Licensed under the MIT license.

No runtime deps