Crate usearch

source ·
Expand description

§USearch Crate for Rust

usearch is a high-performance library for Approximate Nearest Neighbor (ANN) search in high-dimensional spaces. It offers efficient and scalable solutions for indexing and querying dense vector spaces with support for multiple distance metrics and vector types.

This crate wraps the native functionalities of USearch, providing Rust-friendly interfaces and integration capabilities. It is designed to facilitate rapid development and deployment of applications requiring fast and accurate vector search functionalities, such as recommendation systems, image retrieval systems, and natural language processing tasks.


  • SIMD-accelerated distance calculations for various metrics.
  • Support for f32, f64, i8, custom f16, and binary (b1x8) vector types.
  • Extensible with custom distance metrics and filtering predicates.
  • Efficient serialization and deserialization for persistence and network transfers.

§Quick Start

Refer to the Index struct for detailed usage examples.




  • Approximate Nearest Neighbors search index for dense vectors.
  • A byte-wide bit vector type that provides low-level control over individual bits.
  • A struct representing a half-precision floating-point number based on the IEEE 754 standard.


  • Represents errors that can occur when addressing bits.
  • Represents custom metric functions for calculating distances between vectors in various formats.


  • Trait for types that can be addressed at the bit level. Provides methods to set and get individual bits within the implementing type.
  • The VectorType trait defines operations for managing and querying vectors in an index. It supports generic operations on vectors of different types, allowing for the addition, retrieval, and search of vectors within an index.


Type Aliases§

  • The distance type used to represent the similarity between vectors. It is a 32-bit floating-point number.
  • The key type used to identify vectors in the index. It is a 64-bit unsigned integer.
  • Callback signature for custom metric functions, defined in the Rust layer and used in the C++ layer.
  • Callback signature for custom predicate functions, defined in the Rust layer and used in the C++ layer.