diff --git a/nusamai-3dtiles/Cargo.toml b/nusamai-3dtiles/Cargo.toml index 9e78f034c..a7e8805e0 100644 --- a/nusamai-3dtiles/Cargo.toml +++ b/nusamai-3dtiles/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] serde = { version = "1.0.192", features = ["derive"] } -serde_json = { version = "1.0.108", features = ["float_roundtrip"] } +serde_json = { version = "1.0.108", features = ["indexmap", "float_roundtrip"] } serde_repr = "0.1.17" nusamai-gltf = { path = "../nusamai-gltf" } diff --git a/nusamai-citygml/Cargo.toml b/nusamai-citygml/Cargo.toml index 3623db1d7..aa736f729 100644 --- a/nusamai-citygml/Cargo.toml +++ b/nusamai-citygml/Cargo.toml @@ -8,6 +8,7 @@ default = ["serde"] serde = ["dep:serde", "serde_json", "nusamai-geometry/serde"] [dependencies] +ahash = "0.8.7" chrono = { version = "0.4.31", features = ["serde"], default-features = false } indexmap = { version = "2.1", features = ["serde"] } macros = { path = "./macros" } @@ -15,6 +16,6 @@ nusamai-geometry = { path = "../nusamai-geometry", features = ["serde"]} nusamai-projection = { path = "../nusamai-projection"} quick-xml = "0.31" serde = { version = "1.0", features = ["derive"], optional = true } -serde_json = { version = "1.0.108", optional = true } +serde_json = { version = "1.0.108", features = ["indexmap"], optional = true } thiserror = "1.0" url = "2.5.0" diff --git a/nusamai-citygml/macros/src/derive.rs b/nusamai-citygml/macros/src/derive.rs index 7b9ce6c94..8e344e5a3 100644 --- a/nusamai-citygml/macros/src/derive.rs +++ b/nusamai-citygml/macros/src/derive.rs @@ -240,7 +240,7 @@ fn generate_citygml_impl_for_struct( typename: #typename.into(), id: #id_value, attributes: { - let mut attributes = ::nusamai_citygml::object::Map::new(); + let mut attributes = ::nusamai_citygml::object::Map::default(); #(#into_object_stmts)* attributes }, @@ -255,7 +255,7 @@ fn generate_citygml_impl_for_struct( ::nusamai_citygml::object::Data { typename: #typename.into(), attributes: { - let mut attributes = ::nusamai_citygml::object::Map::new(); + let mut attributes = ::nusamai_citygml::object::Map::default(); #(#into_object_stmts)* attributes }, diff --git a/nusamai-citygml/src/geometry.rs b/nusamai-citygml/src/geometry.rs index d5fa568af..16465fc0a 100644 --- a/nusamai-citygml/src/geometry.rs +++ b/nusamai-citygml/src/geometry.rs @@ -54,7 +54,7 @@ pub struct GeometryStore { #[derive(Default)] pub(crate) struct GeometryCollector { - pub vertices: indexmap::IndexSet<[u64; 3]>, + pub vertices: indexmap::IndexSet<[u64; 3], ahash::RandomState>, pub multipolygon: MultiPolygon<'static, 1, u32>, pub multilinestring: MultiLineString<'static, 1, u32>, pub multipoint: MultiPoint<'static, 1, u32>, diff --git a/nusamai-citygml/src/object.rs b/nusamai-citygml/src/object.rs index 2dae152f8..26351b132 100644 --- a/nusamai-citygml/src/object.rs +++ b/nusamai-citygml/src/object.rs @@ -6,7 +6,7 @@ use crate::Measure; use chrono::NaiveDate; use serde::{Deserialize, Serialize}; -pub type Map = indexmap::IndexMap; +pub type Map = indexmap::IndexMap; #[derive(Debug, Deserialize, Serialize)] pub struct CityObject { @@ -136,7 +136,7 @@ mod tests { let value = obj.to_attribute_json(); assert_eq!(value, json!(["test", 1])); - let mut attributes = Map::new(); + let mut attributes = Map::default(); attributes.insert("String".into(), Value::String("test".into())); attributes.insert("Integer".into(), Value::Integer(1)); let obj = Value::Feature(Feature { @@ -158,7 +158,7 @@ mod tests { } ); - let mut attributes = Map::new(); + let mut attributes = Map::default(); attributes.insert("String".into(), Value::String("test".into())); attributes.insert("Integer".into(), Value::Integer(1)); let obj = Value::Data(Data { diff --git a/nusamai-citygml/src/values.rs b/nusamai-citygml/src/values.rs index a530eabb8..f20c91d28 100644 --- a/nusamai-citygml/src/values.rs +++ b/nusamai-citygml/src/values.rs @@ -372,7 +372,7 @@ impl CityGMLElement for GenericAttribute { } fn into_object(self) -> Option { - let mut map = object::Map::new(); + let mut map = object::Map::default(); map.extend( self.string_attrs .into_iter() diff --git a/nusamai-geojson/Cargo.toml b/nusamai-geojson/Cargo.toml index 3220a6fb7..88492c1a5 100644 --- a/nusamai-geojson/Cargo.toml +++ b/nusamai-geojson/Cargo.toml @@ -8,4 +8,4 @@ edition = "2021" [dependencies] geojson = "0.24.1" nusamai-geometry = { path = "../nusamai-geometry" } -serde_json = "1.0.108" +serde_json = { version = "1.0.108", features = ["indexmap"] } diff --git a/nusamai-gltf/Cargo.toml b/nusamai-gltf/Cargo.toml index 22443a4b6..a8b114f95 100644 --- a/nusamai-gltf/Cargo.toml +++ b/nusamai-gltf/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] serde = { version = "1.0.192", features = ["derive"] } -serde_json = { version = "1.0.108", features = ["float_roundtrip"] } +serde_json = { version = "1.0.108", features = ["indexmap", "float_roundtrip"] } serde_repr = "0.1.17" [dev-dependencies] diff --git a/nusamai-plateau/Cargo.toml b/nusamai-plateau/Cargo.toml index 5bc35127d..d4b38783e 100644 --- a/nusamai-plateau/Cargo.toml +++ b/nusamai-plateau/Cargo.toml @@ -13,6 +13,7 @@ nusamai-citygml = { path = "../nusamai-citygml", features = ["serde"]} chrono = { version = "0.4.31", features = ["serde"], default-features = false } url = "2.5.0" stretto = "0.8.2" +hashbrown = "0.14.3" [dev-dependencies] zstd = { version = "0.13.0", features = ["zdict_builder"] } diff --git a/nusamai-plateau/src/codelist/resolver.rs b/nusamai-plateau/src/codelist/resolver.rs index f432a3dc6..b894cb46f 100644 --- a/nusamai-plateau/src/codelist/resolver.rs +++ b/nusamai-plateau/src/codelist/resolver.rs @@ -1,11 +1,13 @@ -use std::{collections::HashMap, path::PathBuf}; +use std::path::PathBuf; use super::xml::{parse_dictionary, Definition}; -use nusamai_citygml::codelist::CodeResolver; -use nusamai_citygml::ParseError; +use hashbrown::HashMap; use stretto::Cache; use url::Url; +use nusamai_citygml::codelist::CodeResolver; +use nusamai_citygml::ParseError; + pub struct Resolver { cache: Cache>, } diff --git a/nusamai-plateau/src/codelist/xml.rs b/nusamai-plateau/src/codelist/xml.rs index 7044f4fec..f031dc717 100644 --- a/nusamai-plateau/src/codelist/xml.rs +++ b/nusamai-plateau/src/codelist/xml.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use hashbrown::HashMap; use std::io::BufRead; use quick_xml::events::Event; @@ -113,7 +113,7 @@ pub fn parse_dictionary( let mut depth = 0; let mut buf = Vec::new(); let mut buf2 = Vec::new(); - let mut definitions = HashMap::new(); + let mut definitions = HashMap::default(); loop { match reader.read_event_into(&mut buf) { diff --git a/nusamai/Cargo.toml b/nusamai/Cargo.toml index 5b0c40dfe..d25184dbb 100644 --- a/nusamai/Cargo.toml +++ b/nusamai/Cargo.toml @@ -19,7 +19,7 @@ nusamai-geojson = { path = "../nusamai-geojson" } nusamai-geometry = { path = "../nusamai-geometry" } nusamai-projection = { path = "../nusamai-projection" } geojson = "0.24.1" -serde_json = "1.0.108" +serde_json = { version = "1.0.108", features = ["indexmap"] } url = "2.5.0" nusamai-gpkg = { path = "../nusamai-gpkg" } tokio = { version = "1.35.1", features = ["full"] }