Skip to content

Commit a6a11d2

Browse files
authored
feat: Replace HashMap with IndexMap for properties in GLTF extensions and Tileset statistics (#2)
1 parent 07b1085 commit a6a11d2

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ license = "MIT"
55
name = "cesiumtiles"
66

77
[dependencies]
8+
indexmap = { version = "2.8.0", features = ["rayon", "serde"] }
89
serde = { version = "1.0.208", features = ["derive"] }
910
serde_json = { version = "1.0.125", features = ["float_roundtrip", "indexmap"] }
1011
serde_repr = "0.1.19"

src/models/gltf_extensions/gltf/ext_structural_metadata.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata
44
5+
use indexmap::IndexMap;
56
use serde::{Deserialize, Serialize};
67
use serde_json::Value;
78
use std::collections::HashMap;
@@ -81,8 +82,8 @@ pub struct Class {
8182
pub description: Option<String>,
8283

8384
/// A dictionary, where each key is a property ID and each value is an object defining the property.
84-
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
85-
pub properties: HashMap<String, ClassProperty>,
85+
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
86+
pub properties: IndexMap<String, ClassProperty>,
8687

8788
/// JSON object with extension-specific objects.
8889
#[serde(skip_serializing_if = "Option::is_none")]
@@ -288,8 +289,8 @@ pub struct PropertyTable {
288289
pub count: u32,
289290

290291
/// A dictionary, where each key corresponds to a property ID and each value is an object describing where property values are stored.
291-
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
292-
pub properties: HashMap<String, PropertyTableProperty>,
292+
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
293+
pub properties: IndexMap<String, PropertyTableProperty>,
293294

294295
/// JSON object with extension-specific objects.
295296
#[serde(skip_serializing_if = "Option::is_none")]

src/models/tileset.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ pub struct Tileset {
357357
#[serde(deny_unknown_fields)]
358358
pub struct Statistics {
359359
/// A dictionary, where each key corresponds to a class ID in the `classes` dictionary of the metatata schema that was defined for the tileset that contains these statistics. Each value is an object containing statistics about entities that conform to the class.
360-
361360
#[serde(skip_serializing_if = "Option::is_none")]
362361
pub classes: Option<HashMap<String, StatisticsClass>>,
363362

0 commit comments

Comments
 (0)