Struct qdrant_client::client::QdrantClientConfig
source · pub struct QdrantClientConfig {
pub uri: String,
pub timeout: Duration,
pub connect_timeout: Duration,
pub keep_alive_while_idle: bool,
pub api_key: Option<String>,
pub compression: Option<CompressionEncoding>,
}Fields§
§uri: String§timeout: Duration§connect_timeout: Duration§keep_alive_while_idle: bool§api_key: Option<String>API key or token to use for authorization
compression: Option<CompressionEncoding>Implementations§
source§impl QdrantClientConfig
impl QdrantClientConfig
pub fn from_url(url: &str) -> Self
sourcepub fn set_api_key(&mut self, api_key: &str)
pub fn set_api_key(&mut self, api_key: &str)
Sets the API key or token
pub fn set_timeout(&mut self, timeout: Duration)
pub fn set_connect_timeout(&mut self, connect_timeout: Duration)
pub fn set_keep_alive_while_idle(&mut self, keep_alive_while_idle: bool)
pub fn set_compression(&mut self, compression: Option<CompressionEncoding>)
sourcepub fn with_api_key(self, api_key: impl MaybeApiKey) -> Self
pub fn with_api_key(self, api_key: impl MaybeApiKey) -> Self
set the API key, builder-like. The API key argument can be any of
&str, String, Option<&str>``, OptionorResult.
§Examples:
A typical use case might be getting the key from an env var:
use qdrant_client::prelude::*;
let client = QdrantClient::from_url("localhost:6334")
.with_api_key(std::env::var("QDRANT_API_KEY"))
.build();Another possibility might be getting it out of some config
use qdrant_client::prelude::*;
let client = QdrantClientConfig::from_url("localhost:6334")
.with_api_key(config.get("api_key"))
.build();sourcepub fn keep_alive_while_idle(self) -> Self
pub fn keep_alive_while_idle(self) -> Self
Configure the service to keep the connection alive while idle
sourcepub fn with_timeout(self, timeout: impl AsTimeout) -> Self
pub fn with_timeout(self, timeout: impl AsTimeout) -> Self
Set the timeout for this client
sourcepub fn with_connect_timeout(self, timeout: impl AsTimeout) -> Self
pub fn with_connect_timeout(self, timeout: impl AsTimeout) -> Self
Set the connect timeout for this client
sourcepub fn with_compression(self, compression: Option<CompressionEncoding>) -> Self
pub fn with_compression(self, compression: Option<CompressionEncoding>) -> Self
Set the compression to use for this client
sourcepub fn build(self) -> Result<QdrantClient>
pub fn build(self) -> Result<QdrantClient>
Build the QdrantClient
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QdrantClientConfig
impl RefUnwindSafe for QdrantClientConfig
impl Send for QdrantClientConfig
impl Sync for QdrantClientConfig
impl Unpin for QdrantClientConfig
impl UnwindSafe for QdrantClientConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request