Skip to content

Conversation

@Maki-Grz
Copy link

This PR adds documentation examples demonstrating how to integrate the Qdrant client with the most popular Rust web frameworks: Actix-web, Axum, and Rocket.

As gRPC response types (from prost) do not implement serde::Serialize by default, these examples demonstrate the recommended pattern: sharing the client via application state and using serde_json::json! as a bridge to return serializable JSON to web clients.

Changes

  • Updated Cargo.toml: Added frameworks to [dev-dependencies] and declared new [[example]] sections.
  • examples/actix_web.rs: Demonstrates state sharing via web::Data.
  • examples/axum.rs: Demonstrates state sharing via extract::State.
  • examples/rocket.rs: Demonstrates managed state via rocket::State.

How to test

  1. Run a Qdrant instance: docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant
  2. Run any example (features are handled automatically via required-features):
    cargo run --example axum

Query the endpoint: curl http://localhost:3000/collections

All Submissions:

  • Contributions should target the dev branch.
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests?

New Feature Submissions:

  • Does your submission pass tests? (Verified via cargo check --examples)
  • Have you formatted your code locally using cargo +nightly fmt --all?
  • Have you checked your code using cargo clippy --all --all-features?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why?
  • Have you written new tests for your core changes?
  • Have you successfully ran tests with your changes locally?
    (N/A: This PR only adds documentation examples)

Add three new examples demonstrating how to use the Qdrant client within
popular Rust web frameworks. Each example shows how to manage shared
state and handle gRPC-to-JSON serialization.

- Added actix-web, axum, and rocket to dev-dependencies
- Declared examples with 'serde' required-feature in Cargo.toml
- Implemented state sharing and basic endpoints in each framework
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant