pub struct ArcVectorClientConfig {
pub uri: String,
pub timeout: Duration,
pub connect_timeout: Duration,
pub keep_alive_while_idle: bool,
pub api_key: Option<String>,
}
Fields§
§uri: String
§timeout: Duration
§connect_timeout: Duration
§keep_alive_while_idle: bool
§api_key: Option<String>
Implementations§
Source§impl ArcVectorClientConfig
impl ArcVectorClientConfig
pub fn from_url(url: &str) -> Self
pub fn set_api_key(&mut self, api_key: &str)
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)
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>``,
Optionor
Result.
§Examples:
A typical use case might be getting the key from an env var:
use arc_vector_rust::prelude::*;
let client = ArcVectorClient::from_url("localhost:6334")
.with_api_key(std::env::var("ARC_VECTOR_API_KEY"))
.build();
Another possibility might be getting it out of some config
use arc_vector_rust::prelude::*;
let client = ArcVectorClientConfig::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 build(self) -> Result<ArcVectorClient>
pub fn build(self) -> Result<ArcVectorClient>
Build the ArcVectorClient
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArcVectorClientConfig
impl RefUnwindSafe for ArcVectorClientConfig
impl Send for ArcVectorClientConfig
impl Sync for ArcVectorClientConfig
impl Unpin for ArcVectorClientConfig
impl UnwindSafe for ArcVectorClientConfig
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