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

feat: Meet api interoperability guidelines #4

Merged
merged 2 commits into from
May 23, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/boundary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub trait Area<C: Coordinate>: Clone {
}

/// A rectangular area
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Boundary<C>
where
C: Coordinate,
Expand Down Expand Up @@ -107,7 +107,7 @@ where
let half_dx = dx / two;
let half_dy = dy / two;
[
Boundary::new(self.p1.clone(), half_dx, half_dy),
Boundary::new(self.p1, half_dx, half_dy),
Boundary::between_points_unchecked(
(self.p1.x + half_dx, self.p1.y),
(self.p2.x, self.p1.y + half_dy),
Expand All @@ -116,10 +116,7 @@ where
(self.p1.x, self.p1.y + half_dy),
(self.p1.x + half_dx, self.p2.y),
),
Boundary::between_points_unchecked(
(self.p1.x + half_dx, self.p1.y + half_dy),
self.p2.clone(),
),
Boundary::between_points_unchecked((self.p1.x + half_dx, self.p1.y + half_dy), self.p2),
]
}

Expand Down
4 changes: 2 additions & 2 deletions src/bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub trait Capacity: Clone + Copy {
}

/// A Capacity known at compile time
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
pub struct ConstCap<const CAP: usize>;
impl<const CAP: usize> Capacity for ConstCap<CAP> {
#[inline]
Expand All @@ -13,7 +13,7 @@ impl<const CAP: usize> Capacity for ConstCap<CAP> {
}

/// A Capacity known at runtime
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
pub struct DynCap(pub(super) usize);
impl Capacity for DynCap {
#[inline]
Expand Down
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub use iter::*;
/// C: The type used for coordinates
/// Item: The type to be saved
/// CAP: The maximum capacity of each level
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug, Clone)]
pub struct QuadTree<C, Item, Cap = DynCap>
where
C: Coordinate,
Expand All @@ -56,7 +56,7 @@ where
}

/// Possible errors
#[derive(PartialEq)]
#[derive(PartialEq, Eq, Clone)]
pub enum QuadTreeError<C>
where
C: Coordinate,
Expand All @@ -75,7 +75,7 @@ where
}

/// A point in two dimensional space
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub struct Point<C>
where
C: Coordinate,
Expand Down Expand Up @@ -179,7 +179,6 @@ where
pub fn capacity(&self) -> usize {
self.capacity.capacity()
}

}

impl<C, Item, Cap> QuadTree<C, Item, Cap>
Expand Down