Function nom_stl::parse_stl[][src]

pub fn parse_stl<R: Read + Seek>(bytes: &mut R) -> Result<Mesh, Error>

Parse a binary or an ASCII stl. Binary stls ar not supposed to begin with the bytes solid, but unfortunately they sometimes do in the real world. For this reason, we use a simple regex heuristic to determine if the stl contains the bytes facet normal, which is a byte sequence specifically used in ASCII stls. If the file contains this sequence, we assume ASCII, otherwise binary. While a binary stl can in theory contain this sequence, the odds of this are low. This is a tradeoff to avoid something both more complicated and less performant.