|
2 | 2 |
|
3 | 3 | use std::sync::Arc; |
4 | 4 |
|
| 5 | +use arrow_array::OffsetSizeTrait; |
| 6 | + |
5 | 7 | use crate::array::*; |
6 | 8 | use crate::trait_::GeoArrowArray; |
7 | 9 |
|
@@ -118,22 +120,22 @@ pub trait AsGeoArrowArray { |
118 | 120 | self.as_geometry_opt().unwrap() |
119 | 121 | } |
120 | 122 |
|
121 | | - /// Downcast this to a [`WKBArray`] with `i32` offsets returning `None` if not possible |
122 | | - fn as_wkb_opt(&self) -> Option<&WKBArray<i32>>; |
| 123 | + /// Downcast this to a [`WKBArray`] with `O` offsets returning `None` if not possible |
| 124 | + fn as_wkb_opt<O: OffsetSizeTrait>(&self) -> Option<&WKBArray<O>>; |
123 | 125 |
|
124 | | - /// Downcast this to a [`WKBArray`] with `i32` offsets panicking if not possible |
| 126 | + /// Downcast this to a [`WKBArray`] with `O` offsets panicking if not possible |
125 | 127 | #[inline] |
126 | | - fn as_wkb(&self) -> &WKBArray<i32> { |
127 | | - self.as_wkb_opt().unwrap() |
| 128 | + fn as_wkb<O: OffsetSizeTrait>(&self) -> &WKBArray<O> { |
| 129 | + self.as_wkb_opt::<O>().unwrap() |
128 | 130 | } |
129 | 131 |
|
130 | | - /// Downcast this to a [`WKBArray`] with `i64` offsets returning `None` if not possible |
131 | | - fn as_large_wkb_opt(&self) -> Option<&WKBArray<i64>>; |
| 132 | + /// Downcast this to a [`WKTArray`] with `O` offsets returning `None` if not possible |
| 133 | + fn as_wkt_opt<O: OffsetSizeTrait>(&self) -> Option<&WKTArray<O>>; |
132 | 134 |
|
133 | | - /// Downcast this to a [`WKBArray`] with `i64` offsets panicking if not possible |
| 135 | + /// Downcast this to a [`WKTArray`] with `O` offsets panicking if not possible |
134 | 136 | #[inline] |
135 | | - fn as_large_wkb(&self) -> &WKBArray<i64> { |
136 | | - self.as_large_wkb_opt().unwrap() |
| 137 | + fn as_wkt<O: OffsetSizeTrait>(&self) -> &WKTArray<O> { |
| 138 | + self.as_wkt_opt::<O>().unwrap() |
137 | 139 | } |
138 | 140 | } |
139 | 141 |
|
@@ -185,13 +187,13 @@ impl AsGeoArrowArray for dyn GeoArrowArray + '_ { |
185 | 187 | } |
186 | 188 |
|
187 | 189 | #[inline] |
188 | | - fn as_wkb_opt(&self) -> Option<&WKBArray<i32>> { |
189 | | - self.as_any().downcast_ref::<WKBArray<i32>>() |
| 190 | + fn as_wkb_opt<O: OffsetSizeTrait>(&self) -> Option<&WKBArray<O>> { |
| 191 | + self.as_any().downcast_ref::<WKBArray<O>>() |
190 | 192 | } |
191 | 193 |
|
192 | 194 | #[inline] |
193 | | - fn as_large_wkb_opt(&self) -> Option<&WKBArray<i64>> { |
194 | | - self.as_any().downcast_ref::<WKBArray<i64>>() |
| 195 | + fn as_wkt_opt<O: OffsetSizeTrait>(&self) -> Option<&WKTArray<O>> { |
| 196 | + self.as_any().downcast_ref::<WKTArray<O>>() |
195 | 197 | } |
196 | 198 | } |
197 | 199 |
|
@@ -242,12 +244,12 @@ impl AsGeoArrowArray for Arc<dyn GeoArrowArray> { |
242 | 244 | } |
243 | 245 |
|
244 | 246 | #[inline] |
245 | | - fn as_wkb_opt(&self) -> Option<&WKBArray<i32>> { |
246 | | - self.as_any().downcast_ref::<WKBArray<i32>>() |
| 247 | + fn as_wkb_opt<O: OffsetSizeTrait>(&self) -> Option<&WKBArray<O>> { |
| 248 | + self.as_any().downcast_ref::<WKBArray<O>>() |
247 | 249 | } |
248 | 250 |
|
249 | 251 | #[inline] |
250 | | - fn as_large_wkb_opt(&self) -> Option<&WKBArray<i64>> { |
251 | | - self.as_any().downcast_ref::<WKBArray<i64>>() |
| 252 | + fn as_wkt_opt<O: OffsetSizeTrait>(&self) -> Option<&WKTArray<O>> { |
| 253 | + self.as_any().downcast_ref::<WKTArray<O>>() |
252 | 254 | } |
253 | 255 | } |
0 commit comments