Skip to main content

Build

Trait Build 

Source
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§

Source

type Output: AsyncFriendly

Custom output parameters. This augments the standard metrics collected by build and allows implementation-specific data to be returned.

Required Methods§

Source

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.

Source

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", so this trait is not object safe.

Implementors§

Source§

impl<DP> Build for DropDeleted<DP>
where DP: DataProvider<Context: Default> + Delete + DefaultAccessor, for<'a> <DP as DefaultAccessor>::Accessor<'a>: AsNeighborMut,

Source§

impl<DP, S> Build for InplaceDelete<DP, S>
where DP: DataProvider<Context: Default> + Delete, S: InplaceDeleteStrategy<DP> + Clone,

Source§

impl<DP, T, S> Build for MultiInsert<DP, T, S>
where DP: DataProvider<Context: Default> + for<'a> SetElement<&'a [T]>, S: MultiInsertStrategy<DP, Matrix<T>> + Clone + 'static, T: AsyncFriendly + Clone,

Source§

impl<DP, T, S> Build for SingleInsert<DP, T, S>
where DP: DataProvider<Context: Default> + for<'a> SetElement<&'a [T]>, S: for<'a> InsertStrategy<DP, &'a [T]> + Clone + AsyncFriendly, T: AsyncFriendly + Clone,