pub struct NetworkConfig {
pub timeout: u64,
pub max_concurrency: usize,
pub user_agent: String,
}Expand description
Network configuration for HTTP fetcher requests.
Created automatically from FetchOptions by [fetch_releases].
For low-level use with [create_fetcher], use NetworkConfig::new()
or construct via struct literal.
§Examples
ⓘ
use rs_histver::{create_fetcher, NetworkConfig, ReleaseFetcher};
let network = NetworkConfig::new()
.timeout_secs(30)
.max_concurrency(5);
let fetcher = create_fetcher("stable", false, 30)?;
let releases = fetcher.fetch(&network).await?;Fields§
§timeout: u64§max_concurrency: usize§user_agent: StringImplementations§
Source§impl NetworkConfig
impl NetworkConfig
Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Set the HTTP request timeout in seconds.
Sourcepub fn max_concurrency(self, n: usize) -> Self
pub fn max_concurrency(self, n: usize) -> Self
Set the maximum number of concurrent HTTP requests.
Sourcepub fn user_agent(self, ua: impl Into<String>) -> Self
pub fn user_agent(self, ua: impl Into<String>) -> Self
Set a custom User-Agent header.
Trait Implementations§
Source§impl Clone for NetworkConfig
impl Clone for NetworkConfig
Source§fn clone(&self) -> NetworkConfig
fn clone(&self) -> NetworkConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 NetworkConfig
impl Debug for NetworkConfig
Source§impl Default for NetworkConfig
impl Default for NetworkConfig
Source§impl From<&FetchOptions> for NetworkConfig
impl From<&FetchOptions> for NetworkConfig
Source§fn from(opts: &FetchOptions) -> Self
fn from(opts: &FetchOptions) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for NetworkConfig
impl RefUnwindSafe for NetworkConfig
impl Send for NetworkConfig
impl Sync for NetworkConfig
impl Unpin for NetworkConfig
impl UnsafeUnpin for NetworkConfig
impl UnwindSafe for NetworkConfig
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