diff --git a/benches/sources.rs b/benches/sources.rs index bac20aa6c..5c7791de6 100644 --- a/benches/sources.rs +++ b/benches/sources.rs @@ -52,7 +52,7 @@ fn main() {} // // async fn get_table_source_tile() { // let source = mock_table_source("public", "table_source").await; -// let xyz = Xyz::new(0, 0, 0); +// let xyz = Xyz { z: 0, x: 0, y: 0 }; // let _tile = source.get_tile(&xyz, &None).await.unwrap(); // } // @@ -77,7 +77,7 @@ fn main() {} // table_sources: vec![points1, points2], // }; // -// let xyz = Xyz::new(0, 0, 0); +// let xyz = Xyz { z: 0, x: 0, y: 0 }; // let _tile = source.get_tile(&xyz, &None).await.unwrap(); // } // @@ -88,7 +88,7 @@ fn main() {} // // async fn get_function_source_tile() { // let source = mock_function_source("public", "function_zxy_query"); -// let xyz = Xyz::new(0, 0, 0); +// let xyz = Xyz { z: 0, x: 0, y: 0 }; // // let _tile = source.get_tile(&xyz, &None).await.unwrap(); // } diff --git a/src/source.rs b/src/source.rs index 9b72fcaac..2a95a9076 100644 --- a/src/source.rs +++ b/src/source.rs @@ -15,12 +15,6 @@ pub struct Xyz { pub y: i32, } -impl Xyz { - pub fn new(z: i32, x: i32, y: i32) -> Self { - Self { z, x, y } - } -} - impl Display for Xyz { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { if f.alternate() { @@ -129,7 +123,7 @@ mod tests { #[test] fn xyz_format() { - let xyz = Xyz::new(1, 2, 3); + let xyz = Xyz { z: 1, x: 2, y: 3 }; assert_eq!(format!("{xyz}"), "1,2,3"); assert_eq!(format!("{xyz:#}"), "1/2/3"); } diff --git a/src/srv/server.rs b/src/srv/server.rs index 2bc984075..5c5d4efcd 100755 --- a/src/srv/server.rs +++ b/src/srv/server.rs @@ -243,7 +243,11 @@ async fn get_tile( let (sources, format) = state.get_sources(&path.source_ids, Some(path.z))?; let query = Some(query.into_inner()); - let xyz = Xyz::new(path.z, path.x, path.y); + let xyz = Xyz { + z: path.z, + x: path.x, + y: path.y, + }; let tile = try_join_all(sources.into_iter().map(|s| s.get_tile(&xyz, &query))) .await diff --git a/tests/function_source_test.rs b/tests/function_source_test.rs index 32846985f..dbd2798e9 100644 --- a/tests/function_source_test.rs +++ b/tests/function_source_test.rs @@ -51,7 +51,10 @@ async fn function_source_tilejson() { async fn function_source_tile() { let mock = mock_unconfigured().await; let src = source(&mock, "function_zxy_query"); - let tile = src.get_tile(&Xyz::new(0, 0, 0), &None).await.unwrap(); + let tile = src + .get_tile(&Xyz { z: 0, x: 0, y: 0 }, &None) + .await + .unwrap(); assert!(!tile.is_empty()); } diff --git a/tests/table_source_test.rs b/tests/table_source_test.rs index 296f7e3c6..d596eef23 100644 --- a/tests/table_source_test.rs +++ b/tests/table_source_test.rs @@ -57,7 +57,10 @@ async fn tables_tilejson_ok() { async fn tables_tile_ok() { let mock = mock_unconfigured().await; let src = source(&mock, "table_source"); - let tile = src.get_tile(&Xyz::new(0, 0, 0), &None).await.unwrap(); + let tile = src + .get_tile(&Xyz { z: 0, x: 0, y: 0 }, &None) + .await + .unwrap(); assert!(!tile.is_empty()); }