mirror of
https://github.com/andreytkachenko/kdtree-rust.git
synced 2024-11-25 02:46:22 +04:00
Upgrade to 2018
This commit is contained in:
parent
863e23c869
commit
09606936ad
10
Cargo.toml
10
Cargo.toml
@ -7,17 +7,19 @@ keywords = ["tree", "dimension" , "nearest", "search", "neighbor"]
|
||||
readme = "README.md"
|
||||
license = "Unlicense"
|
||||
description = "K-dimensional tree implemented in Rust for fast NN querying."
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "kdtree"
|
||||
path = "src//lib.rs"
|
||||
path = "src/lib.rs"
|
||||
bench = false
|
||||
|
||||
[[bench]]
|
||||
name = "bench"
|
||||
path = "src/bench.rs"
|
||||
harness = false
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = "~0.3"
|
||||
rand = "~0.3.12"
|
||||
bencher = "~0.1.2"
|
||||
quickcheck = "~0.9"
|
||||
rand = "~0.7"
|
||||
bencher = "~0.1"
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[macro_use] extern crate bencher;
|
||||
#[macro_use]
|
||||
extern crate bencher;
|
||||
extern crate kdtree;
|
||||
extern crate rand;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use ::kdtree::*;
|
||||
use crate::kdtree::KdTreePoint;
|
||||
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Bounds {
|
||||
@ -91,8 +92,8 @@ impl Bounds {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ::kdtree::test_common::*;
|
||||
use super::Bounds;
|
||||
use crate::kdtree::test_common::Point2WithId;
|
||||
|
||||
#[test]
|
||||
fn bounds_test() {
|
||||
|
@ -311,7 +311,7 @@ impl<T: KdTreePoint> KdTreeNode<T> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ::kdtree::test_common::Point2WithId;
|
||||
use crate::kdtree::test_common::Point2WithId;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use ::kdtree::*;
|
||||
use crate::kdtree::KdTreePoint;
|
||||
|
||||
enum PointsWereOnSide {
|
||||
Left,
|
||||
@ -125,14 +125,9 @@ fn partition_kdtree<T: KdTreePoint>(vec: &mut [T], index_of_splitting_point: usi
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ::kdtree::*;
|
||||
use ::kdtree::test_common::*;
|
||||
|
||||
use ::rand::distributions::{IndependentSample, Range};
|
||||
use ::rand::*;
|
||||
|
||||
use super::*;
|
||||
use super::partition_kdtree;
|
||||
use crate::kdtree::test_common::{Point1WithId, Point2WithId};
|
||||
use rand::Rng;
|
||||
|
||||
#[test]
|
||||
fn parition_kdtree_works() {
|
||||
@ -166,11 +161,11 @@ mod tests {
|
||||
if xs.len() == 0 {
|
||||
return true;
|
||||
}
|
||||
let between = Range::new(0, xs.len());
|
||||
let mut rng = thread_rng();
|
||||
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
for _ in 0 .. 5 {
|
||||
let random_splitting_index = between.ind_sample(&mut rng);
|
||||
let random_splitting_index = rng.gen_range(0, xs.len());
|
||||
|
||||
let mut vec = vec.clone();
|
||||
|
||||
|
@ -6,3 +6,6 @@ extern crate quickcheck;
|
||||
extern crate rand;
|
||||
|
||||
pub mod kdtree;
|
||||
|
||||
#[cfg(test)]
|
||||
mod bench;
|
||||
|
Loading…
Reference in New Issue
Block a user