Crate gldf_rs

Source
Expand description

§gldf_rs

GLDF (Global Lighting Data Format) Library

The GLDF crate provides a set of structures and tools for working with the Global Lighting Data Format (GLDF), a standardized format for describing lighting products, their characteristics, and technical details.

GLDF is used in the lighting industry to exchange product information between manufacturers, designers, and other stakeholders, ensuring consistent representation and interoperability across various software tools.

This crate offers utilities for serializing and deserializing GLDF data, enabling you to read and write GLDF files while adhering to the ISO 7127 standard. It also provides helper macros for working with GLDF-specific attributes.

For more information about GLDF and its specifications, https::gldf.io and refer to the ISO 7127 standard.

§Features

  • Serialize and deserialize GLDF files in compliance with ISO 7127 standard.
  • From XML into JSON and vice versa.
  • Define GLDF-specific attributes using custom procedural macros.
  • Easily work with GLDF data structures and their components.

For more usage examples and detailed documentation, please refer to the documentation of individual modules and structs. Most functions are implemented as methods on the struct GldfProduct, which shall represent the Root of the XML structure. For more information see : gldf_rs::gldf::GldfProduct

GldfProduct

§Example

use gldf_rs::gldf::GldfProduct;
let loaded: GldfProduct = GldfProduct::load_gldf("./tests/data/test.gldf").unwrap();
println!("{:?}", loaded);
// Display pretty printed XML
let x_serialized = loaded.to_xml().unwrap();
println!("{}", x_serialized);
let json_str = loaded.to_json().unwrap();
println!("{}", json_str);
let j_loaded: GldfProduct = GldfProduct::from_json(&json_str).unwrap();
let x_reserialized =  j_loaded.to_xml().unwrap();
println!("{}", x_reserialized);
assert_eq!(x_serialized, x_reserialized);

For more information about GLDF and its specifications, refer to the ISO 7127 standard.

§License

This project is licensed under the terms of the MIT license.

Re-exports§

pub use gldf::*;

Modules§

gldf
the gldf module (src/gldf/mod.rs)

Structs§

BufFile
FileBufGldf

Traits§

AsyncLogger
Logger

Functions§

fetch_binary_data_async
helper function to get the content of the url as File from the given url not used for the wasm portage, which overrides this function
fetch_binary_from_url
fetch_binary_from_url_with_logging
fetch_binary_from_url_with_logging_async
fetch_text_from_url
fetch_text_from_url_async