{"id":22472289,"url":"https://github.com/ckampfe/fstl","last_synced_at":"2025-07-20T17:04:24.662Z","repository":{"id":72030527,"uuid":"458674118","full_name":"ckampfe/fstl","owner":"ckampfe","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-16T06:25:27.000Z","size":13489,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T16:22:05.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ckampfe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-13T00:39:32.000Z","updated_at":"2022-02-13T00:46:22.000Z","dependencies_parsed_at":"2023-04-05T23:08:19.061Z","dependency_job_id":null,"html_url":"https://github.com/ckampfe/fstl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ckampfe/fstl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Ffstl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Ffstl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Ffstl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Ffstl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckampfe","download_url":"https://codeload.github.com/ckampfe/fstl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Ffstl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266161900,"owners_count":23885927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-06T12:14:12.698Z","updated_at":"2025-07-20T17:04:24.640Z","avatar_url":"https://github.com/ckampfe.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fstl\n\nLoad a binary [STL](https://en.wikipedia.org/wiki/STL_(file_format)) file very quickly\n\n## SAFETY WARNING / should you use this\n\nThis library basically transmutes a slice of bytes (`\u0026[u8]`) directly into a slice of triangles (`\u0026[Triangle]`). This happens without parsing/lexing, meaning that loading the STL only costs approximately as much as it costs to perform the IO to load the STL into memory in the first place. The tradeoff is that in order to do this, this library uses `unsafe`.\n\nTo ensure correctness in this usage of `unsafe`, it makes a few assumptions about the input STL:\n- The STL must be a binary STL; ASCII STLs are not supported.\n- The STL header section must correctly report the number of triangles contained in the rest of the input.\n- The length in bytes of the triangles section of the STL files is exactly equal to `NUMBER_OF_TRIANGLES * 50`.\n- All numerics must be little-endian encoded.\n- All numerics must fit within their corresponding `u32`, `f32`, and `u16` numerics in Rust (i.e., no overflow, etc). See the representation of `Triangle` in `lib.rs`.\n\nFailing to meet some of these assumptions will cause the program to return an error.\n\nMore importantly, failing to meet other assumptions will cause the program to load and report incorrect values silently. For example, if numerics are not litte-endian encoded or they are too large for their corresponding in-memory type, the program will load them anyway and their values will be silently incorrect.\n\nIf you know your inputs meet the assumptions above, `fstl` might work for your use case. Otherwise, you ought to use something like [nom_stl](https://github.com/fast-radius/nom_stl).\n\nI've fuzzed `fstl` with [afl++](https://github.com/AFLplusplus/AFLplusplus) and have (so far) not been able to cause it to crash or hang (see the `fuzz` directory). It also does not report any undefined behavior when running the tests under [Miri](https://github.com/rust-lang/miri). Fuzzing and Miri are not proof that `fstl` (or any other Rust program) does not exhibit UB, but they give you more information for you to make your own choice as to whether `fstl` is safe enough for your use case.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Ffstl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckampfe%2Ffstl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Ffstl/lists"}