Fix serde support for larger ZeroNodes
This commit is contained in:
parent
04094ce06f
commit
27d5e9b522
|
@ -5,6 +5,9 @@ license = "MIT OR Apache-2.0"
|
|||
authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
with-serde = ["serde", "serde-big-array"]
|
||||
|
||||
[dependencies]
|
||||
ahash = "0.6.1"
|
||||
indicatif = { version = "0.15", optional = true }
|
||||
|
@ -13,3 +16,4 @@ ordered-float = "2.0"
|
|||
rand = { version = "0.8", features = ["small_rng"] }
|
||||
rayon = "1.5"
|
||||
serde = { version = "1.0.118", features = ["derive"], optional = true }
|
||||
serde-big-array = { version = "0.3.1", optional = true }
|
||||
|
|
|
@ -12,6 +12,8 @@ use rand::{Rng, SeedableRng};
|
|||
use rayon::iter::{IntoParallelRefMutIterator, ParallelIterator};
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "serde")]
|
||||
use serde_big_array::big_array;
|
||||
|
||||
/// Parameters for building the `Hnsw`
|
||||
#[derive(Default)]
|
||||
|
@ -622,9 +624,12 @@ struct ZeroNode {
|
|||
/// The nearest neighbors on this layer
|
||||
///
|
||||
/// This is always kept in sorted order (near to far).
|
||||
#[serde(with = "BigArray")]
|
||||
nearest: [PointId; M * 2],
|
||||
}
|
||||
|
||||
big_array! { BigArray; }
|
||||
|
||||
impl Default for ZeroNode {
|
||||
fn default() -> ZeroNode {
|
||||
ZeroNode { nearest: [PointId::invalid(); M * 2] }
|
||||
|
|
Loading…
Reference in New Issue