Skip to content

Commit 1362582

Browse files
committed
Bug 1967617 - Replace individual Geoname::admin{level}_code properties with one admin_division_codes map
This replaces the individual `Geoname::admin{level}_code` properties with a single `admin_division_codes` map. A few reasons: * I'm working on another patch that adds a way for consumers to fetch localized/alternate names for geonames, including alternates for a geoname's admin divisions. I'm introducing another struct for that, and I don't want to repeat `admin{level}_name` for each level in that struct. * I like the idea of not baking the max number of levels into the public API. * Not a big deal, but a map is similar to how AccuWeather's location API handles admin divisions, although it uses an array of objects instead of one object.
1 parent c798658 commit 1362582

File tree

2 files changed

+85
-134
lines changed

2 files changed

+85
-134
lines changed

components/suggest/src/benchmarks/geoname.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,12 @@ impl BenchmarkWithInput for GeonameBenchmark {
6666
pub fn all_benchmarks() -> Vec<(&'static str, GeonameBenchmark)> {
6767
let ny_state = Geoname {
6868
geoname_id: 5128638,
69-
geoname_type: GeonameType::Admin1,
69+
geoname_type: GeonameType::AdminDivision { level: 1 },
7070
name: "New York".to_string(),
7171
feature_class: "A".to_string(),
7272
feature_code: "ADM1".to_string(),
7373
country_code: "US".to_string(),
74-
admin1_code: Some("NY".to_string()),
75-
admin2_code: None,
76-
admin3_code: None,
77-
admin4_code: None,
74+
admin_division_codes: [(1, "NY".to_string())].into(),
7875
population: 19274244,
7976
latitude: "43.00035".to_string(),
8077
longitude: "-75.4999".to_string(),

0 commit comments

Comments
 (0)