gldf-rs
A cross-platform GLDF (General Lighting Data Format) processing library for Rust.
Overview
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 specifications- Photometry files (Eulumdat/LDT, IES)
- Images and documentation
- L3D 3D model files
Learn more at: https://gldf.io
Features
- Parse GLDF containers and
product.xmldefinitions - Convert between XML and JSON representations
- Extract and process embedded files (images, photometry, 3D models)
- Support for meta-information.xml
- Optional HTTP support for URL-based file references
- WASM-compatible (disable
httpfeature)
Installation
[]
= "0.3"
For WASM builds, disable HTTP support:
[]
= { = "0.3", = false }
Quick Start
use GldfProduct;
// Load from file
let loaded = load_gldf.unwrap;
// Convert to XML
let xml = loaded.to_xml.unwrap;
println!;
// Convert to JSON
let json = loaded.to_json.unwrap;
println!;
// Round-trip: JSON back to XML
let from_json = from_json.unwrap;
assert_eq!;
Working with Embedded Files
// Get photometry files
let phot_files = loaded.get_phot_files.unwrap;
for f in phot_files.iter
// Get image files
let images = loaded.get_image_def_files.unwrap;
for img in images.iter
// Load from buffer (useful for WASM)
let buffer = read.unwrap;
let loaded = load_gldf_from_buf.unwrap;
Live Demo
Try the WASM-based GLDF viewer at: https://gldf.icu
Related Crates
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 |
Release Notes
0.3.0
- Major refactor using quick-xml for XML parsing (replaces yaserde)
- Restructured as part of monorepo
- Optional HTTP feature for URL file references
- WASM-compatible build support
- Improved error handling with anyhow
0.2.2
- Added support for meta-information.xml
0.2.1
- Refactored for WASM support
0.2.0
- Refactored into submodules
- Added BOM-encoded UTF8 support
- Added URL file type support
License
MIT License