diff --git a/geo-types/src/lib.rs b/geo-types/src/lib.rs index e91127657..642e6d482 100644 --- a/geo-types/src/lib.rs +++ b/geo-types/src/lib.rs @@ -95,7 +95,7 @@ pub trait CoordinateType: Num + Copy + NumCast + PartialOrd + Debug {} #[allow(deprecated)] impl 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. /// @@ -106,6 +106,7 @@ pub trait CoordNum: CoordinateType + Debug {} #[allow(deprecated)] impl 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 CoordFloat for T {} diff --git a/geo/src/geometry.rs b/geo/src/geometry.rs index 71bcaeb41..a9dd8eb20 100644 --- a/geo/src/geometry.rs +++ b/geo/src/geometry.rs @@ -1 +1,2 @@ +//! This module makes all geometry types available pub use geo_types::geometry::*; diff --git a/geo/src/lib.rs b/geo/src/lib.rs index c60c5b1fd..024189da5 100644 --- a/geo/src/lib.rs +++ b/geo/src/lib.rs @@ -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`]. /// @@ -285,5 +285,6 @@ impl GeoFloat for T where { } +/// A trait for methods which work for both integers **and** floating point pub trait GeoNum: CoordNum + HasKernel {} impl GeoNum for T where T: CoordNum + HasKernel {}