Skip to main content

ClientConfig

Struct ClientConfig 

Source
pub struct ClientConfig {
    pub connect_timeout: Duration,
    pub call_timeout: Duration,
    pub credentials: Option<Credentials>,
    pub client_name: Option<String>,
    pub tls: Option<ClientTls>,
}
Expand description

Client configuration: connect timeout default 10 s (CLT-001), per-call timeout default 30 s (CLT-020), optional credentials and client name for the handshake (CLT-002).

Fields§

§connect_timeout: Duration

TCP connect timeout (CLT-001). Default 10 s.

§call_timeout: Duration

Default per-call timeout (CLT-020); override per call with Client::call_with_timeout. Default 30 s.

§credentials: Option<Credentials>

Handshake credentials, when the configured handshake wants them.

§client_name: Option<String>

Client identifier sent in the HELLO map (HelloMandatory).

§tls: Option<ClientTls>

Optional TLS (FR-29 / SPEC-008 CAN-020). Some dials TLS; None (the default) keeps plaintext. Requires the crate’s tls feature — a client configured with TLS but built without it fails to connect with a Connection error rather than silently dialing plaintext.

Implementations§

Source§

impl ClientConfig

Source

pub fn new() -> Self

Defaults: 10 s connect, 30 s per call, no credentials.

Source

pub fn connect_timeout(self, timeout: Duration) -> Self

Set the connect timeout (CLT-001).

Source

pub fn call_timeout(self, timeout: Duration) -> Self

Set the default per-call timeout (CLT-020).

Source

pub fn token(self, token: impl Into<String>) -> Self

Authenticate with a bearer token.

Source

pub fn api_key(self, api_key: impl Into<String>) -> Self

Authenticate with an API key.

Source

pub fn user_pass(self, user: impl Into<String>, pass: impl Into<String>) -> Self

Authenticate with user + password (AuthCommand handshakes).

Source

pub fn client_name(self, name: impl Into<String>) -> Self

Set the client name announced in the HELLO map.

Source

pub fn with_tls(self, tls: ClientTls) -> Self

Dial TLS (FR-29): the client completes a tokio-rustls handshake before any Thunder frame. Requires the crate’s tls feature.

Trait Implementations§

Source§

impl Clone for ClientConfig

Source§

fn clone(&self) -> ClientConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ClientConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.