Skip to content

Commit

Permalink
Merge #862
Browse files Browse the repository at this point in the history
862: Add docs for some missing items r=michaelkirk a=urschrei

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/main/CODE_OF_CONDUCT.md).
- [ ] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---

Last one, I promise!

Co-authored-by: Stephan Hügel <shugel@tcd.ie>
  • Loading branch information
bors[bot] and urschrei committed Jun 24, 2022
2 parents 6b01547 + fe451c1 commit 1429c32
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion geo-types/src/lib.rs
Expand Up @@ -95,7 +95,7 @@ pub trait CoordinateType: Num + Copy + NumCast + PartialOrd + Debug {}
#[allow(deprecated)]
impl<T: Num + Copy + NumCast + PartialOrd + Debug> CoordinateType for T {}

/// The type of an x or y value of a point/coordinate.
/// For algorithms which can use both integer **and** floating point `Point`s/`Coordinate`s
///
/// Floats (`f32` and `f64`) and Integers (`u8`, `i32` etc.) implement this.
///
Expand All @@ -106,6 +106,7 @@ pub trait CoordNum: CoordinateType + Debug {}
#[allow(deprecated)]
impl<T: CoordinateType + Debug> CoordNum for T {}

/// For algorithms which can only use floating point `Point`s/`Coordinate`s, like area or length calculations
pub trait CoordFloat: CoordNum + Float {}
impl<T: CoordNum + Float> CoordFloat for T {}

Expand Down
1 change: 1 addition & 0 deletions geo/src/geometry.rs
@@ -1 +1,2 @@
//! This module makes all geometry types available
pub use geo_types::geometry::*;
5 changes: 3 additions & 2 deletions geo/src/lib.rs
Expand Up @@ -238,11 +238,11 @@ pub mod prelude {
pub use crate::algorithm::*;
}

/// A common numeric trait used for geo algorithms.
/// A common numeric trait used for geo algorithms
///
/// Different numeric types have different tradeoffs. `geo` strives to utilize generics to allow
/// users to choose their numeric types. If you are writing a function which you'd like to be
/// generic over all the numeric types supported by geo, you probably want to constraint
/// generic over all the numeric types supported by geo, you probably want to constrain
/// your function input to `GeoFloat`. For methods which work for integers, and not just floating
/// point, see [`GeoNum`].
///
Expand Down Expand Up @@ -285,5 +285,6 @@ impl<T> GeoFloat for T where
{
}

/// A trait for methods which work for both integers **and** floating point
pub trait GeoNum: CoordNum + HasKernel {}
impl<T> GeoNum for T where T: CoordNum + HasKernel {}

0 comments on commit 1429c32

Please sign in to comment.