pub struct ClientConfig {
pub allow_private: Vec<IpNet>,
pub user_agent: String,
pub connect_timeout: Duration,
pub timeout: Duration,
pub max_response_bytes: usize,
pub max_redirects: usize,
pub pool_idle_timeout: Duration,
pub pool_max_idle_per_host: usize,
}Expand description
How the client behaves.
Fields§
§allow_private: Vec<IpNet>Networks the client may reach although they are not public.
user_agent: StringThe User-Agent sent with every request.
connect_timeout: DurationHow long a connection may take to open.
timeout: DurationHow long a whole request may take, response included.
max_response_bytes: usizeThe largest response body read; a longer one is an error.
max_redirects: usizeHow many redirects a GET follows.
pool_idle_timeout: DurationHow long a connection is kept open, unused, for another request to the same host.
pool_max_idle_per_host: usizeHow many unused connections are kept open to one host.
A fan-out sends to thousands of hosts once each, and every connection kept for reuse is a socket and its buffers: left unbounded, as the HTTP client’s defaults leave it, a post to 9,258 servers held 3,900 sockets and 370 MiB. Mastodon closes a connection after 30 seconds idle and keeps 512 at most.
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 (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 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