The Rust SDK is in “alpha” and is under active development. The SDK should be considered unstable and should not be used in production. Before a 1.0 release, there are no guarantees of backward compatibility between minor versions. See the Rust SDK README for full installation instructions and usage examples.

Install

To install the latest version of the Rust SDK, add a dependency to the current project:

cargo add pinecone-sdk

Initialize

Once installed, you can import the SDK and then use an API key to initialize a client instance:

Rust
use pinecone_sdk::pinecone::PineconeClientConfig;   
use pinecone_sdk::utils::errors::PineconeError;
	
#[tokio::main]
async fn main() -> Result<(), PineconeError> {
    let config = PineconeClientConfig {
        api_key: Some("YOUR_API_KEY".to_string()),
        ..Default::default()
    };

    let pinecone = config.client()?;
    let indexes = pinecone.list_indexes().await?;

    println!("Indexes: {:?}", indexes);

    Ok(())
}