Skip to content

Commit 9f1af54

Browse files
committed
Minor fixes
+ add more docs + add more types to Kernel (i16, i128, isize)
1 parent 27b9af9 commit 9f1af54

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

geo/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ use-serde = ["serde", "geo-types/serde"]
3434
[dev-dependencies]
3535
approx = "0.3.0"
3636
criterion = { version = "0.3" }
37-
png = "0.16.7"
38-
float_extras = "0.1.6"
3937

4038
[[bench]]
4139
name = "area"

geo/src/algorithm/kernels/mod.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ pub trait HasKernel: CoordinateType {
4545
type Ker: Kernel<Scalar = Self>;
4646
}
4747

48-
#[macro_export]
48+
// Helper macro to implement `HasKernel` on a a scalar type
49+
// `T` (first arg.) by assigning the second arg. It expects
50+
// the second arg. to be a type that takes one generic
51+
// parameter that is `T`.
52+
#[macro_use]
4953
macro_rules! has_kernel {
5054
($t:ident, $k:ident) => {
5155
impl $crate::algorithm::kernels::HasKernel for $t {
@@ -59,8 +63,13 @@ pub use self::robust::RobustKernel;
5963
has_kernel!(f64, RobustKernel);
6064
has_kernel!(f32, RobustKernel);
6165

62-
6366
pub mod simple;
6467
pub use self::simple::SimpleKernel;
68+
6569
has_kernel!(i64, SimpleKernel);
6670
has_kernel!(i32, SimpleKernel);
71+
has_kernel!(i16, SimpleKernel);
72+
has_kernel!(isize, SimpleKernel);
73+
74+
#[cfg(has_i128)]
75+
has_kernel!(i128, SimpleKernel);

geo/src/utils.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ where
127127
}
128128
}
129129

130-
/// Compute index of the lexicographically least point.
131-
/// Should only be called on a non-empty slice.
130+
/// Compute index of the lexicographically least point. In
131+
/// other words, point with minimum `x` coord, and breaking
132+
/// ties with minimum `y` coord. Should only be called on a
133+
/// non-empty slice with no `nan` coordinates.
132134
pub fn lexicographically_least_index<T: Copy + PartialOrd>(pts: &[T]) -> usize {
133135
assert!(pts.len() > 0);
134136

0 commit comments

Comments
 (0)