pub struct Client { /* private fields */ }Available on crate feature
std only.Expand description
A blocking HTTP/1.1 client: one connection per request.
| Setting | Default |
|---|---|
| limits | Limits::new with a 16 MiB body |
| connect, read, and write timeout | 30 s each |
§Examples
use std::time::Duration;
use http_net::{blocking::Client, Limits};
let client = Client::new()
.with_limits(Limits::new().with_max_body(64 << 20))
.with_timeout(Duration::from_secs(5));
let resp = client.get("http://127.0.0.1:8080/big")?;Implementations§
Source§impl Client
impl Client
Sourcepub const fn with_limits(self, limits: Limits) -> Self
pub const fn with_limits(self, limits: Limits) -> Self
Sets the response limits.
§Examples
let _ = http_net::blocking::Client::new().with_limits(http_net::Limits::new());Sourcepub const fn with_timeout(self, timeout: Duration) -> Self
pub const fn with_timeout(self, timeout: Duration) -> Self
Sets the connect, read, and write timeout (zero is raised to 1 ms).
§Examples
let _ = http_net::blocking::Client::new().with_timeout(std::time::Duration::from_secs(2));Trait Implementations§
impl Copy for Client
impl Eq for Client
impl StructuralPartialEq for Client
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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