pub struct ClientConfig {
pub endpoint: String,
pub origin: Option<String>,
pub compression: Option<CompressionType>,
pub rate_limit: Option<String>,
pub tls_setting: TlsClientConfig,
pub keepalive: Option<KeepaliveConfig>,
pub connect_timeout: Duration,
pub request_timeout: Duration,
pub buffer_size: Option<usize>,
pub headers: HashMap<String, String>,
pub auth: AuthenticationConfig,
}Expand description
Struct for the client configuration. This struct contains the endpoint, origin, compression type, rate limit, TLS settings, keepalive settings, timeout settings, buffer size settings, headers, and auth settings. The client configuration can be converted to a tonic channel.
Fields§
§endpoint: StringThe target the client will connect to.
origin: Option<String>Origin for the client.
compression: Option<CompressionType>Compression type - TODO(msardara): not implemented yet.
rate_limit: Option<String>Rate Limits
tls_setting: TlsClientConfigTLS client configuration.
keepalive: Option<KeepaliveConfig>Keepalive parameters.
connect_timeout: DurationTimeout for the connection.
request_timeout: DurationTimeout per request.
buffer_size: Option<usize>ReadBufferSize.
headers: HashMap<String, String>The headers associated with gRPC requests.
auth: AuthenticationConfigAuth configuration for outgoing RPCs.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn with_endpoint(endpoint: &str) -> Self
pub fn with_endpoint(endpoint: &str) -> Self
Creates a new client configuration with the given endpoint. This function will return a ClientConfig with the endpoint set and all other fields set to default.
pub fn with_origin(self, origin: &str) -> Self
pub fn with_compression(self, compression: CompressionType) -> Self
pub fn with_rate_limit(self, rate_limit: &str) -> Self
pub fn with_tls_setting(self, tls_setting: TLSSetting) -> Self
pub fn with_keepalive(self, keepalive: KeepaliveConfig) -> Self
pub fn with_connect_timeout(self, connect_timeout: Duration) -> Self
pub fn with_request_timeout(self, request_timeout: Duration) -> Self
pub fn with_buffer_size(self, buffer_size: usize) -> Self
pub fn with_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_auth(self, auth: AuthenticationConfig) -> Self
Sourcepub fn to_channel(
&self,
) -> Result<impl GrpcService<Body, Error: Into<StdError> + Send, ResponseBody: Body<Data = Bytes, Error: Into<StdError> + Send> + Send + 'static, Future: Send> + Send + use<>, ConfigError>
pub fn to_channel( &self, ) -> Result<impl GrpcService<Body, Error: Into<StdError> + Send, ResponseBody: Body<Data = Bytes, Error: Into<StdError> + Send> + Send + 'static, Future: Send> + Send + use<>, ConfigError>
Converts the client configuration to a tonic channel. This function will return a Result with the channel if the configuration is valid. If the configuration is invalid, it will return a ConfigError. The function will set the headers, tls settings, keepalive settings, rate limit settings timeout settings, buffer size settings, and origin settings.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Configuration for ClientConfig
impl Configuration for ClientConfig
Source§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl Default for ClientConfig
Defaults for ClientConfig
impl Default for ClientConfig
Defaults for ClientConfig
Source§impl<'de> Deserialize<'de> for ClientConfig
impl<'de> Deserialize<'de> for ClientConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ClientConfig
impl Display for ClientConfig
Source§impl PartialEq for ClientConfig
impl PartialEq for ClientConfig
Source§fn eq(&self, other: &ClientConfig) -> bool
fn eq(&self, other: &ClientConfig) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
impl UnwindSafe for ClientConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
T in a tonic::Request