Moving boring impls down
This commit is contained in:
parent
b7de137d9f
commit
07350f201c
48
src/lib.rs
48
src/lib.rs
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue