diff --git a/src/lib.rs b/src/lib.rs index 5576d70..be40feb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -283,30 +283,6 @@ impl Builder { } } -impl

Index for Hnsw

{ - type Output = P; - - fn index(&self, index: PointId) -> &Self::Output { - &self.points[index.0 as usize] - } -} - -impl Index for Vec

{ - type Output = P; - - fn index(&self, index: PointId) -> &Self::Output { - &self[index.0 as usize] - } -} - -impl Index for [P] { - type Output = P; - - fn index(&self, index: PointId) -> &Self::Output { - &self[index.0 as usize] - } -} - impl Layer for Vec { const LINKS: usize = M * 2; @@ -590,6 +566,30 @@ impl Default for PointId { } } +impl

Index for Hnsw

{ + type Output = P; + + fn index(&self, index: PointId) -> &Self::Output { + &self.points[index.0 as usize] + } +} + +impl Index for Vec

{ + type Output = P; + + fn index(&self, index: PointId) -> &Self::Output { + &self[index.0 as usize] + } +} + +impl Index for [P] { + type Output = P; + + fn index(&self, index: PointId) -> &Self::Output { + &self[index.0 as usize] + } +} + /// The parameter `M` from the paper /// /// This should become a generic argument to `Hnsw` when possible.