Moving boring impls down

This commit is contained in:
Dirkjan Ochtman 2020-12-15 11:43:42 +01:00
parent b7de137d9f
commit 07350f201c
1 changed files with 24 additions and 24 deletions

View File

@ -283,30 +283,6 @@ impl Builder {
} }
} }
impl<P> Index<PointId> for Hnsw<P> {
type Output = P;
fn index(&self, index: PointId) -> &Self::Output {
&self.points[index.0 as usize]
}
}
impl<P: Point> Index<PointId> for Vec<P> {
type Output = P;
fn index(&self, index: PointId) -> &Self::Output {
&self[index.0 as usize]
}
}
impl<P: Point> Index<PointId> for [P] {
type Output = P;
fn index(&self, index: PointId) -> &Self::Output {
&self[index.0 as usize]
}
}
impl Layer for Vec<ZeroNode> { impl Layer for Vec<ZeroNode> {
const LINKS: usize = M * 2; const LINKS: usize = M * 2;
@ -590,6 +566,30 @@ impl Default for PointId {
} }
} }
impl<P> Index<PointId> for Hnsw<P> {
type Output = P;
fn index(&self, index: PointId) -> &Self::Output {
&self.points[index.0 as usize]
}
}
impl<P: Point> Index<PointId> for Vec<P> {
type Output = P;
fn index(&self, index: PointId) -> &Self::Output {
&self[index.0 as usize]
}
}
impl<P: Point> Index<PointId> for [P] {
type Output = P;
fn index(&self, index: PointId) -> &Self::Output {
&self[index.0 as usize]
}
}
/// The parameter `M` from the paper /// The parameter `M` from the paper
/// ///
/// This should become a generic argument to `Hnsw` when possible. /// This should become a generic argument to `Hnsw` when possible.