openbim_ifcx_py/
lib.rs

1//! Python bindings for `openbim-ifcx`.
2//!
3//! The compiled module is `openbim_ifcx._native`; the public API is the pure
4//! Python package `openbim_ifcx`, which wraps it. Results cross as JSON text
5//! written by `openbim-ifcx-binding-core`, which the package turns into
6//! dicts and lists with `json.loads`.
7//!
8//! This crate adds calling-convention glue only. IFCX behaviour belongs in
9//! `openbim-ifcx`, shared binding behaviour in `openbim-ifcx-binding-core`.
10
11#![forbid(unsafe_code)]
12
13mod error;
14mod native;
15
16use pyo3::prelude::*;
17
18/// The `openbim_ifcx._native` extension module.
19#[pymodule]
20fn _native(module: &Bound<'_, PyModule>) -> PyResult<()> {
21    module.add_class::<native::NativeFile>()?;
22    module.add_function(wrap_pyfunction!(native::compose_json, module)?)?;
23    module.add_function(wrap_pyfunction!(native::validate_json, module)?)?;
24    module.add_function(wrap_pyfunction!(native::export_glb, module)?)?;
25    module.add("IfcxError", module.py().get_type::<error::IfcxError>())?;
26    Ok(())
27}