diff --git a/.gitignore b/.gitignore index 6e372500..946603af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea target Cargo.lock proj-sys/PROJSRC/proj/ diff --git a/src/proj.rs b/src/proj.rs index fe529292..9900f453 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -1,6 +1,5 @@ use libc::c_int; use libc::{c_char, c_double}; -use num_traits::Float; use proj_sys::{ proj_area_create, proj_area_destroy, proj_area_set_bbox, proj_cleanup, proj_context_create, proj_context_destroy, proj_context_errno, proj_context_get_url_endpoint, @@ -27,8 +26,18 @@ use std::mem::MaybeUninit; use std::path::Path; use thiserror::Error; -pub trait CoordinateType: Float + Copy + PartialOrd + Debug {} -impl CoordinateType for T {} +#[cfg(feature = "geo-types")] +use geo_types::CoordFloat; +#[cfg(not(feature = "geo-types"))] +use num_traits::{Num, Float, NumCast}; +#[cfg(not(feature = "geo-types"))] +pub trait CoordFloat: Float + Num + Copy + NumCast + PartialOrd + PartialOrd + Debug + Default {} +#[cfg(not(feature = "geo-types"))] +impl CoordFloat for T {} + + +pub trait CoordinateType: CoordFloat {} +impl CoordinateType for T {} /// An error number returned from a PROJ call. pub(crate) struct Errno(pub libc::c_int);