Crates.io | l3d_rs |
lib.rs | l3d_rs |
version | 0.1.0 |
source | src |
created_at | 2024-10-09 16:24:33.39585 |
updated_at | 2024-10-09 16:24:33.39585 |
description | L3d (Luminaire 3D (XML Format)) parser and writer for Rust, specifically for the Rust/WASM target as such designed for JSON format |
homepage | https://github.com/holg/l3d-rs |
repository | https://github.com/holg/l3d-rs |
max_upload_size | |
id | 1402558 |
size | 721,198 |
l3d_rs
- A Rust Library for Handling L3D Filesl3d_rs
is a Rust library designed to read, parse, and manipulate .l3d
files, which are ZIP containers that include structured XML files along with other assets such as geometries. This library provides functionality to deserialize .l3d
files into usable Rust structures, serialize them back to XML, and perform JSON conversions for flexibility.
(https://github.com/globallightingdata/l3d)
.l3d
Files: Extract and parse .l3d
ZIP containers..l3d
files..l3d
content to/from both XML and JSON formats.Add l3d_rs
to your Cargo.toml
dependencies:
[dependencies]
l3d_rs = "0.1.0"
.l3d
FileYou can read and deserialize an .l3d
file (which is a ZIP container) into the Luminaire struct.
use l3d_rs::Luminaire;
fn main() {
let file_path = "path/to/your/file.l3d";
// Load and parse the .l3d file
let luminaire = Luminaire::load_l3d(file_path).expect("Failed to load L3D file");
// Work with the luminaire data
println!("{:?}", luminaire);
}
.l3d
file, you can serialize the data back into XML:let luminaire_xml = luminaire.to_xml().expect("Failed to serialize to XML");
println!("{}", luminaire_xml);
JSON
for easy integration with web or other systems:let luminaire_json = luminaire.to_json().expect("Failed to serialize to JSON");
println!("{}", luminaire_json);
let json_data = r#"{ "your": "json_data_here" }"#;
let luminaire_from_json: Luminaire = Luminaire::from_json(json_data).expect("Failed to deserialize from JSON");
println!("{:?}", luminaire_from_json);