| Crates.io | gldf-rs |
| lib.rs | gldf-rs |
| version | 0.3.3 |
| created_at | 2023-06-25 13:52:02.982906+00 |
| updated_at | 2025-12-16 15:16:28.940969+00 |
| description | GLDF (General Lighting Data Format) parser and writer for Rust, specifically for the Rust/WASM target as such designed for JSON format |
| homepage | https://github.com/holg/gldf-rs |
| repository | https://github.com/holg/gldf-rs |
| max_upload_size | |
| id | 899496 |
| size | 284,857 |
A cross-platform GLDF (General Lighting Data Format) processing library for Rust.
gldf-rs provides comprehensive tools for working with GLDF files - the modern container format for luminaire and sensor data defined by the lighting industry (ISO 7127).
GLDF files are ZIP containers containing:
product.xml - Product definitions and specificationsLearn more at: https://gldf.io
product.xml definitionshttp feature)[dependencies]
gldf-rs = "0.3"
For WASM builds, disable HTTP support:
[dependencies]
gldf-rs = { version = "0.3", default-features = false }
use gldf_rs::GldfProduct;
// Load from file
let loaded = GldfProduct::load_gldf("./tests/data/test.gldf").unwrap();
// Convert to XML
let xml = loaded.to_xml().unwrap();
println!("{}", xml);
// Convert to JSON
let json = loaded.to_json().unwrap();
println!("{}", json);
// Round-trip: JSON back to XML
let from_json = GldfProduct::from_json(&json).unwrap();
assert_eq!(loaded.to_xml().unwrap(), from_json.to_xml().unwrap());
// Get photometry files
let phot_files = loaded.get_phot_files().unwrap();
for f in phot_files.iter() {
println!("Photometry: {}", f.file_name);
}
// Get image files
let images = loaded.get_image_def_files().unwrap();
for img in images.iter() {
println!("Image: {}", img.file_name);
}
// Load from buffer (useful for WASM)
let buffer = std::fs::read("test.gldf").unwrap();
let loaded = GldfProduct::load_gldf_from_buf(buffer).unwrap();
Try the WASM-based GLDF viewer at: https://gldf.icu
This crate is part of the gldf-rs ecosystem:
| Crate | Description |
|---|---|
| gldf-rs | Core library (this crate) |
| gldf-rs-wasm | WebAssembly viewer application |
| l3d-rs | L3D 3D model format parsing |
| eulumdat | Eulumdat/LDT photometry parsing |
MIT License