pub struct ClientConfig {
pub server_url: String,
pub auth: AuthMethod,
pub timeout: Duration,
pub retry: RetryConfig,
pub fallback: Option<FallbackStorage>,
}Expand description
Client configuration.
Fields§
§server_url: StringBase URL of the server (e.g., “https://perfgate.example.com/api/v1”).
auth: AuthMethodAuthentication method.
timeout: DurationRequest timeout.
retry: RetryConfigRetry configuration.
fallback: Option<FallbackStorage>Fallback storage when server is unavailable.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn new(server_url: impl Into<String>) -> Self
pub fn new(server_url: impl Into<String>) -> Self
Creates a new client configuration with the specified server URL.
Sourcepub fn with_api_key(self, api_key: impl Into<String>) -> Self
pub fn with_api_key(self, api_key: impl Into<String>) -> Self
Sets the API key for authentication.
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Sets the JWT token for authentication.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets the request timeout.
Sourcepub fn with_retry(self, retry: RetryConfig) -> Self
pub fn with_retry(self, retry: RetryConfig) -> Self
Sets the retry configuration.
Sourcepub fn with_fallback(self, fallback: FallbackStorage) -> Self
pub fn with_fallback(self, fallback: FallbackStorage) -> Self
Sets the fallback storage.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClientConfig
impl Debug 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
Mutably borrows from an owned value. Read more