1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Search-time parameters (nanoflann's `SearchParameters`, nanoflann.hpp:874-881).
/// = nanoflann `SearchParameters` (its legacy `checks` field is dead upstream
/// and not ported). `eps` is multiplicative slack on the node-bound prune:
/// a node is visited iff `mindist * (1 + eps) <= worst_dist`.
/// Build-thread policy. C++ mapping: Sequential = n_thread_build 1 (the
/// default), Auto = 0 (hardware concurrency via rayon's global pool),
/// Threads(n) = a scoped rayon pool of n threads. DEVIATION (documented):
/// Threads(n) guarantees "at most n rayon workers", not C++'s exact
/// async-gating behavior.
///
/// The type exists regardless of features; only the non-`Sequential`
/// BEHAVIOR is feature-gated: without the "parallel" feature,
/// `KdTreeBuilder::build()` panics on `Auto`/`Threads(_)` with a message
/// mirroring C++ `NANOFLANN_NO_THREADS`'s throw ("Multithreading is
/// disabled").
///
/// A second, narrower gate exists even WITH the feature on: `build()`'s
/// signature additionally requires `DS: Sync` whenever "parallel" is
/// enabled (the parallel path shares `&DS` across real rayon worker
/// threads, which requires `Sync`) — so a non-`Sync` `DataSource` (e.g.
/// `Rc`-backed interior mutability) cannot call `build()` at all under the
/// default feature set, even to request a plain `Sequential` build. This is
/// a BOUND on `build()`, not a behavior gate on this enum, and it is what
/// `KdTreeBuilder::build_sequential()` exists to route around: that method
/// carries no `Sync` bound, always compiles, and always builds
/// (`Sequential` only — it panics on `Auto`/`Threads(_)`, since those
/// genuinely cannot run without `Sync`).