Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for some missing items #862

Merged
merged 1 commit into from Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -234,11 +234,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 @@ -281,5 +281,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 {}