pub struct ArchClientBuilder { /* private fields */ }Expand description
What: Builder for creating ArchClient with custom configuration.
Inputs: None (created via ArchClient::builder())
Output: ArchClientBuilder that can be configured and built
Details:
- Allows customization of timeout, user agent, and other settings
- All methods return
&mut Selffor method chaining - Call
build()to create theArchClient
Implementations§
Source§impl ArchClientBuilder
impl ArchClientBuilder
Sourcepub const fn new() -> Self
pub const fn new() -> Self
What: Create a new builder with default values.
Inputs: None
Output:
ArchClientBuilderwith default configuration
Details:
- Default timeout: 30 seconds
- Default user agent: “arch-toolkit/0.1.0”
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
What: Set the HTTP request timeout.
Inputs:
timeout: Duration for request timeout
Output:
&mut Selffor method chaining
Details:
- Overrides default timeout of 30 seconds
- Applied to all HTTP requests made by this client
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
What: Set a custom user agent string.
Inputs:
user_agent: User agent string to use for requests
Output:
&mut Selffor method chaining
Details:
- Overrides default user agent “arch-toolkit/0.1.0”
- Applied to all HTTP requests made by this client
Sourcepub fn retry_policy(self, policy: RetryPolicy) -> Self
pub fn retry_policy(self, policy: RetryPolicy) -> Self
What: Set the retry policy configuration.
Inputs:
policy: Retry policy to use
Output:
Selffor method chaining
Details:
- Overrides default retry policy
- Applied to all AUR operations made by this client
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
What: Set the maximum number of retry attempts.
Inputs:
max_retries: Maximum number of retries (default: 3)
Output:
Selffor method chaining
Details:
- Convenience method to set
max_retrieson the retry policy - Creates default policy if none exists
Sourcepub fn retry_enabled(self, enabled: bool) -> Self
pub fn retry_enabled(self, enabled: bool) -> Self
What: Enable or disable retries globally.
Inputs:
enabled: Whether retries are enabled (default: true)
Output:
Selffor method chaining
Details:
- Convenience method to enable/disable retries
- Creates default policy if none exists
Sourcepub fn retry_operation(self, operation: &str, enabled: bool) -> Self
pub fn retry_operation(self, operation: &str, enabled: bool) -> Self
What: Enable or disable retries for a specific operation type.
Inputs:
operation: Operation name (“search”, “info”, “comments”, “pkgbuild”)enabled: Whether retries are enabled for this operation
Output:
Selffor method chaining
Details:
- Convenience method to configure per-operation retry behavior
- Creates default policy if none exists
- Invalid operation names are ignored
Sourcepub fn cache_config(self, config: CacheConfig) -> Self
pub fn cache_config(self, config: CacheConfig) -> Self
What: Set the cache configuration.
Inputs:
config: Cache configuration to use
Output:
Selffor method chaining
Details:
- Enables caching with the specified configuration
- If not set, caching is disabled (default)
Sourcepub fn build(self) -> Result<ArchClient>
pub fn build(self) -> Result<ArchClient>
What: Build the ArchClient with the configured settings.
Inputs: None
Output:
Result<ArchClient>with configured client, or error if creation fails
Details:
- Uses configured values or defaults if not set
- Creates underlying
reqwest::Clientwith timeout and user agent - Rate limiting is handled automatically by existing static functions
§Errors
- Returns
Err(ArchToolkitError::Network)ifreqwest::Clientcreation fails
Trait Implementations§
Source§impl Clone for ArchClientBuilder
impl Clone for ArchClientBuilder
Source§fn clone(&self) -> ArchClientBuilder
fn clone(&self) -> ArchClientBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more