pub trait Build: AsyncFriendly {
type Output: AsyncFriendly;
// Required methods
fn num_data(&self) -> usize;
fn build(
&self,
range: Range<usize>,
) -> impl Future<Output = ANNResult<Self::Output>> + Send;
}Expand description
The core build API.
This uses a model where the data over which the index build is stored internally and
identified by its index. Data is numbered from 0 to N - 1 where N = Build::num_data()
is the total number of data points.
The trait is used in conjunction with build and build_tracked. See the documentation
of those methods for more details.
Required Associated Types§
Sourcetype Output: AsyncFriendly
type Output: AsyncFriendly
Custom output parameters. This augments the standard metrics collected by build and
allows implementation-specific data to be returned.
Required Methods§
Sourcefn num_data(&self) -> usize
fn num_data(&self) -> usize
Return the number of data points to build the index over. The machinery in build and
build_tracked will partition the range 0..num_data() into disjoint ranges and call
Build::build on each range in an unspecified order.
Sourcefn build(
&self,
range: Range<usize>,
) -> impl Future<Output = ANNResult<Self::Output>> + Send
fn build( &self, range: Range<usize>, ) -> impl Future<Output = ANNResult<Self::Output>> + Send
Insert the data points specified by the range. Implementations may assume that the range is
non-empty, within 0..num_data(), and disjoint from other ranges passed to concurrent calls
while in build or build_tracked.
Multiple calls may be made in parallel.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".