pub fn flatten_owned<I>(nodes: I) -> IndexMap<String, FlatNode>where
I: IntoIterator<Item = IfcxNode>,Expand description
flatten for nodes the caller no longer needs: the nodes are consumed
and their paths, maps, and attribute values move into the result instead
of being copied.
The result equals flatten(&nodes).
use openbim_ifcx::{flatten, flatten_owned, IfcxFile};
let file = IfcxFile::from_json_str(r#"{
"header": {"id": "demo", "ifcxVersion": "ifcx_alpha", "dataVersion": "1.0.0",
"author": "someone", "timestamp": "2026-10-03"},
"imports": [], "schemas": {},
"data": [{"path": "w", "attributes": {"x::height": 2.5}},
{"path": "w", "attributes": {"x::height": 3.0}}]
}"#)?;
let borrowed = flatten(&file.data);
let owned = flatten_owned(file.data);
assert_eq!(owned, borrowed);
assert_eq!(*owned["w"].attributes["x::height"], 3.0);