Skip to content

Commit e0dcdd9

Browse files
committed
fix doc tests
1 parent 43e76b3 commit e0dcdd9

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ pub mod serde_deser;
153153
// Re-exports
154154
pub use crate::payload::Payload;
155155
pub use crate::qdrant_client::error::QdrantError;
156-
pub use crate::qdrant_client::{Qdrant, QdrantBuilder};
156+
pub use crate::qdrant_client::{GenericQdrant, Qdrant, QdrantBuilder};
157157

158158
/// Client configuration
159159
pub mod config {
160160
pub use crate::qdrant_client::config::{
161-
AsOptionApiKey, AsTimeout, CompressionEncoding, QdrantConfig,
161+
AsOptionApiKey, AsTimeout, CompressionEncoding, GenericQdrantConfig, QdrantConfig,
162162
};
163163
}
164164

src/qdrant_client/config.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use crate::auth::{TokenInterceptor, WrappedInterceptor};
66
use crate::qdrant_client::GenericQdrant;
77
use crate::QdrantError;
88

9+
pub type QdrantConfig = GenericQdrantConfig<TokenInterceptor>;
10+
911
struct DefaultConfigValues<I: Send + Sync + 'static + Clone + Interceptor = TokenInterceptor> {
1012
timeout: Duration,
1113
connect_timeout: Duration,
@@ -45,7 +47,7 @@ impl<I: Send + Sync + 'static + Clone + Interceptor> Default for DefaultConfigVa
4547
/// .build();
4648
/// ```
4749
#[derive(Clone)]
48-
pub struct QdrantConfig<I: Send + Sync + 'static + Clone + Interceptor = TokenInterceptor> {
50+
pub struct GenericQdrantConfig<I: Send + Sync + 'static + Clone + Interceptor = TokenInterceptor> {
4951
/// Qdrant server URI to connect to
5052
pub uri: String,
5153

@@ -72,7 +74,7 @@ pub struct QdrantConfig<I: Send + Sync + 'static + Clone + Interceptor = TokenIn
7274
pub interceptor: WrappedInterceptor<I>,
7375
}
7476

75-
impl<I: Send + Sync + 'static + Clone + Interceptor> QdrantConfig<I> {
77+
impl<I: Send + Sync + 'static + Clone + Interceptor> GenericQdrantConfig<I> {
7678
fn with_defaults(url: &str) -> Self {
7779
let defaults = DefaultConfigValues::default();
7880
Self {
@@ -90,7 +92,7 @@ impl<I: Send + Sync + 'static + Clone + Interceptor> QdrantConfig<I> {
9092
/// Start configuring a Qdrant client with an URL
9193
///
9294
/// ```rust,no_run
93-
///# use qdrant_client::config::QdrantConfig;
95+
/// use crate::qdrant_client::config::QdrantConfig;
9496
/// let client = QdrantConfig::from_url("http://localhost:6334").build();
9597
/// ```
9698
///
@@ -151,7 +153,7 @@ impl<I: Send + Sync + 'static + Clone + Interceptor> QdrantConfig<I> {
151153
/// Set the interceptor to use for this client
152154
///
153155
/// ```no_run
154-
/// use qdrant_client::GenericQdrant;
156+
/// use crate::qdrant_client::GenericQdrant;
155157
/// use tonic::service::Interceptor;
156158
/// use tonic::{Request, Status};
157159
///
@@ -164,7 +166,7 @@ impl<I: Send + Sync + 'static + Clone + Interceptor> QdrantConfig<I> {
164166
/// }
165167
///
166168
///# async fn connect() -> Result<(), qdrant_client::QdrantError> {
167-
/// let client = GenericQdrant<CustomInterceptor>::from_url("http://localhost:6334")
169+
/// let client = GenericQdrant::<CustomInterceptor>::from_url("http://localhost:6334")
168170
/// .interceptor(CustomInterceptor)
169171
/// .build()?;
170172
///# Ok(())
@@ -227,7 +229,7 @@ impl<I: Send + Sync + 'static + Clone + Interceptor> QdrantConfig<I> {
227229
}
228230
}
229231

230-
impl QdrantConfig<TokenInterceptor> {
232+
impl GenericQdrantConfig<TokenInterceptor> {
231233
/// Set an optional API key
232234
///
233235
/// This method is only available when using the default TokenInterceptor.
@@ -259,7 +261,7 @@ impl QdrantConfig<TokenInterceptor> {
259261
/// Default Qdrant client configuration.
260262
///
261263
/// Connects to `http://localhost:6334` without an API key.
262-
impl Default for QdrantConfig<TokenInterceptor> {
264+
impl Default for GenericQdrantConfig<TokenInterceptor> {
263265
fn default() -> Self {
264266
Self::with_defaults("http://localhost:6334")
265267
}

src/qdrant_client/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use tonic::Status;
2323

2424
use crate::auth::{TokenInterceptor, WrappedInterceptor};
2525
use crate::channel_pool::ChannelPool;
26+
use crate::config::GenericQdrantConfig;
2627
use crate::qdrant::{qdrant_client, HealthCheckReply, HealthCheckRequest};
2728
use crate::qdrant_client::config::QdrantConfig;
2829
use crate::qdrant_client::version_check::is_compatible;
@@ -87,7 +88,7 @@ pub type Qdrant = GenericQdrant<TokenInterceptor>;
8788
#[derive(Clone)]
8889
pub struct GenericQdrant<I: Send + Sync + 'static + Clone + Interceptor> {
8990
/// Client configuration
90-
pub config: QdrantConfig<I>,
91+
pub config: GenericQdrantConfig<I>,
9192

9293
/// Internal connection pool
9394
channel: Arc<ChannelPool>,
@@ -99,8 +100,8 @@ pub struct GenericQdrant<I: Send + Sync + 'static + Clone + Interceptor> {
99100
impl<I: Send + Sync + 'static + Clone + Interceptor> GenericQdrant<I> {
100101
/// Create a new Qdrant client.
101102
///
102-
/// Constructs the client and connects based on the given [`QdrantConfig`](config::QdrantConfig).
103-
pub fn new(config: QdrantConfig<I>) -> QdrantResult<Self> {
103+
/// Constructs the client and connects based on the given [`GenericQdrantConfig`](config::GenericQdrantConfig).
104+
pub fn new(config: GenericQdrantConfig<I>) -> QdrantResult<Self> {
104105
if config.check_compatibility {
105106
// create a temporary client to check compatibility
106107
let channel = ChannelPool::new(
@@ -176,8 +177,8 @@ impl<I: Send + Sync + 'static + Clone + Interceptor> GenericQdrant<I> {
176177
/// ```
177178
///
178179
/// See more ways to set up the client [here](Self#set-up).
179-
pub fn from_url(url: &str) -> QdrantConfig<I> {
180-
QdrantConfig::<I>::from_url(url)
180+
pub fn from_url(url: &str) -> GenericQdrantConfig<I> {
181+
GenericQdrantConfig::<I>::from_url(url)
181182
}
182183

183184
/// Wraps a channel with the configured interceptor

0 commit comments

Comments
 (0)