### SahomeDB Quickstart with Rust Source: https://github.com/chinosam/sahomedb/blob/main/readme.md Demonstrates how to open a database, create a collection with random records, and perform a nearest neighbor search using SahomeDB. ```rust use sahomedb::prelude::*; fn main() { // Vector dimension must be uniform. let dimension = 128; // Replace with your own data. let records = Record::many_random(dimension, 100); let query = Vector::random(dimension); // Open the database and create a collection. let mut db = Database::open("data/readme").unwrap(); let collection = db.create_collection("vectors", None, Some(&records)).unwrap(); // Search for the nearest neighbors. let result = collection.search(&query, 5).unwrap(); println!("Nearest ID: {}", result[0].id); } ``` -------------------------------- ### Rust Style Guide and Commit Messages Source: https://github.com/chinosam/sahomedb/blob/main/docs/contributing.md Details the coding style and commit message conventions for SahomeDB. It emphasizes using the default Rust lints, specific rustfmt.toml configurations, and the Conventional Commits format for commit messages. ```rust // Adhere to Rust style guide and Conventional Commits. // For specific formatting, refer to rustfmt.toml. // Commit messages should follow the pattern: : ``` -------------------------------- ### Run SahomeDB Benchmarks Source: https://github.com/chinosam/sahomedb/blob/main/readme.md Command to download the benchmarking dataset and run the built-in performance benchmarks for SahomeDB's vector search functionality. ```bash cargo bench ``` -------------------------------- ### Run SahomeDB Tests Source: https://github.com/chinosam/sahomedb/blob/main/docs/contributing.md Executes the test suite for SahomeDB to ensure all components are functioning correctly. This is a crucial step before making any code changes. ```bash cargo test ``` -------------------------------- ### Run SahomeDB Benchmarks Source: https://github.com/chinosam/sahomedb/blob/main/docs/contributing.md Runs performance benchmarks for SahomeDB to measure its efficiency and detect potential performance regressions introduced by code changes. ```bash cargo bench ``` -------------------------------- ### Measure SahomeDB Memory Usage Source: https://github.com/chinosam/sahomedb/blob/main/readme.md This command executes a script to measure SahomeDB's memory usage. Users can modify parameters within the `examples/measure-memory.rs` file to observe changes in memory consumption. ```bash cargo run --example measure-memory ``` -------------------------------- ### Add SahomeDB to Cargo.toml Source: https://github.com/chinosam/sahomedb/blob/main/readme.md Adds the latest version of SahomeDB to your Rust project's Cargo.toml file. ```bash cargo add sahomedb ``` -------------------------------- ### SahomeDB Metadata Handling in Rust Source: https://github.com/chinosam/sahomedb/blob/main/readme.md Shows how to insert and extract metadata associated with vectors in SahomeDB. Metadata can store additional information like text strings. ```rust use sahomedb::prelude::*; fn main() { // Inserting a metadata value into a record. let data: &str = "This is an example."; let vector = Vector::random(128); let record = Record::new(&vector, &data.into()); // Extracting the metadata value. let metadata = record.data.clone(); let data = match metadata { Metadata::Text(value) => value, _ => panic!("Data is not a text."), }; println!("{}", data); } ``` -------------------------------- ### Pull Request Title Format Source: https://github.com/chinosam/sahomedb/blob/main/docs/contributing.md Specifies the required format for pull request titles to maintain consistency and organization within the project's commit history. This format aligns with Conventional Commits. ```bash : For example: feat: add support ... fix: fix issue ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.