pub struct ProviderConfig {
pub api_key: String,
pub base_url: Option<String>,
pub timeout_ms: Option<u64>,
pub proxy: Option<String>,
pub retry: Option<RetryConfig>,
pub headers: Option<HashMap<String, String>>,
pub max_concurrent_requests: Option<usize>,
}Expand description
Configuration for a single provider
This is the unified configuration structure used across all protocols. It contains all the necessary information to create and configure a provider.
Fields§
§api_key: StringAPI key for authentication
base_url: Option<String>Optional base URL override If not provided, the protocol’s default URL will be used
timeout_ms: Option<u64>Request timeout in milliseconds
proxy: Option<String>Optional HTTP proxy URL
retry: Option<RetryConfig>Retry configuration
headers: Option<HashMap<String, String>>Custom HTTP headers
max_concurrent_requests: Option<usize>Maximum concurrent requests (for connection pooling)
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Create a new provider configuration with just an API key
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Set the base URL
Sourcepub fn with_timeout_ms(self, timeout_ms: u64) -> Self
pub fn with_timeout_ms(self, timeout_ms: u64) -> Self
Set the timeout in milliseconds
Sourcepub fn with_proxy(self, proxy: impl Into<String>) -> Self
pub fn with_proxy(self, proxy: impl Into<String>) -> Self
Set the proxy URL
Sourcepub fn with_retry(self, retry: RetryConfig) -> Self
pub fn with_retry(self, retry: RetryConfig) -> Self
Set the retry configuration
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a custom header
Sourcepub fn with_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_headers(self, headers: HashMap<String, String>) -> Self
Set custom headers
Sourcepub fn with_max_concurrent_requests(self, max: usize) -> Self
pub fn with_max_concurrent_requests(self, max: usize) -> Self
Set maximum concurrent requests
Sourcepub fn retry_config(&self) -> RetryConfig
pub fn retry_config(&self) -> RetryConfig
Get the retry configuration, or default if not set
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
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 ProviderConfig
impl Debug for ProviderConfig
Source§impl<'de> Deserialize<'de> for ProviderConfig
impl<'de> Deserialize<'de> for ProviderConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§fn from(config: ProviderConfig) -> Self
fn from(config: ProviderConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ProviderConfig
impl RefUnwindSafe for ProviderConfig
impl Send for ProviderConfig
impl Sync for ProviderConfig
impl Unpin for ProviderConfig
impl UnwindSafe for ProviderConfig
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