weldr, the link between your favorite building blocks and Rust

LICENSE Crates.io Version CI Coverage Status Minimum rustc version

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 file containing 2 commands:

```rust extern crate weldr;

use weldr::{parse_raw, CommandType, CommentCmd, LineCmd, Vec3};

fn main() {}

[test]

fn testweldr() { let cmd0 = CommandType::Comment(CommentCmd{ text: "this is a comment".tostring() }); let cmd1 = CommandType::Line(LineCmd{ color: 16, vertices: [ Vec3{ x: 0.0, y: 0.0, z: 0.0 }, Vec3{ x: 1.0, y: 1.0, z: 1.0 } ] }); asserteq!(parseraw(b"0 this is a comment\n2 16 0 0 0 1 1 1"), vec![cmd0, cmd1]); } ```

Documentation

Reference documentation

Rust version requirements

weldr is tested with rustc version 1.44, stable, and beta, although older versions may work, but have never been tested.

Installation

weldr is available on crates.io and can be included in your Cargo enabled project like this:

toml [dependencies] weldr = "0.2"

Then include it in your code like this:

rust,ignore 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:

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.