Skip to content

Commit

Permalink
Merge pull request #1230 from georust/mkirk/enable-i128-geoms
Browse files Browse the repository at this point in the history
Enable geom for i128, which is always available.
  • Loading branch information
frewsxcv authored Oct 15, 2024
2 parents 7195b7f + d567532 commit ce66c49
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions geo/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
* Improve `HasDimensions::dimensions` to handle dimensionally collapsed and empty geometries more consistently.
A collection (like MultiPolygon) will now have EmptyDimensions when all of its elements have EmptyDimensions.
* <https://github.com/georust/geo/pull/1226>
* Enable i128 geometry types
* <https://github.com/georust/geo/pull/1230>

## 0.28.0

Expand Down
21 changes: 15 additions & 6 deletions geo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,16 +347,14 @@ macro_rules! impl_geo_num_for_int {
};
}

// This is the list of primitives that we support. It should match our set of implementations for HasKernel since GeoNum
// depends on HasKernel.
// This is the list of primitives that we support.
impl_geo_num_for_float!(f32);
impl_geo_num_for_float!(f64);
impl_geo_num_for_int!(i64);
impl_geo_num_for_int!(i32);
impl_geo_num_for_int!(i16);
impl_geo_num_for_int!(isize);
#[cfg(has_i128)]
impl_geo_num_for_int!(i32);
impl_geo_num_for_int!(i64);
impl_geo_num_for_int!(i128);
impl_geo_num_for_int!(isize);

#[cfg(test)]
mod tests {
Expand All @@ -378,4 +376,15 @@ mod tests {
assert_eq!(GeoNum::total_cmp(&2i32, &2i32), Ordering::Equal);
assert_eq!(GeoNum::total_cmp(&1i32, &2i32), Ordering::Less);
}

#[test]
fn numeric_types() {
let _n_i16 = Point::new(1i16, 2i16);
let _n_i32 = Point::new(1i32, 2i32);
let _n_i64 = Point::new(1i64, 2i64);
let _n_i128 = Point::new(1i128, 2i128);
let _n_isize = Point::new(1isize, 2isize);
let _n_f32 = Point::new(1.0f32, 2.0f32);
let _n_f64 = Point::new(1.0f64, 2.0f64);
}
}

0 comments on commit ce66c49

Please sign in to comment.