weldr, the link between your favorite building blocks and Rust
weldr is a Rust library to manipulate LDraw files (format specification), which are files describing 3D models of LEGO®* pieces.
weldr allows building command-line tools and applications leveraging the fantastic database of pieces contributed by the LDraw community.
Example
Parse a single .ldr line containing a file reference command (line type 1):
extern crate weldr;
use read_lines;
The read_lines() function can be used to parse an entire file too.
Documentation
Rust version requirements
weldr was only tested so far with Rustc version 1.47 although older versions may work, but for lack of time have never been tested.
Installation
weldr is available on crates.io and can be included in your Cargo enabled project like this:
[]
= "0.1"
Then include it in your code like this:
extern crate weldr;
Technical features
weldr leverages the nom parser combinator library to efficiently and reliably parse LDraw files, and transform them into in-memory data structures for consumption. All parsing is done on &[u8] input expected to contain specification-compliant LDraw content. In particular, this means:
- UTF-8 encoded input
- Both DOS/Windows
<CR><LF>and Unix<LF>line termination accepted
Copyrights
The current code repository is licensed under the MIT license.
LDraw™ is a trademark owned and licensed by the Estate of James Jessiman, which does not sponsor, endorse, or authorize this project.
LEGO® is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this project.