pub struct Client<R: DnsResolver> { /* private fields */ }
Expand description
A Client to make outgoing HTTP requests.
Uses an specific DNS resolver.
Implementations§
Source§impl<R: DnsResolver + 'static> Client<R>
impl<R: DnsResolver + 'static> Client<R>
Sourcepub fn new(resolver: R) -> Client<R>
pub fn new(resolver: R) -> Client<R>
Create a new client with a specific DNS resolver.
This bypasses /etc/resolv.conf
.
Sourcepub fn get(&self, url: &str) -> ResponseFuture
pub fn get(&self, url: &str) -> ResponseFuture
Shorthand function to do a GET request with HttpClient::request
.
Source§impl Client<Resolver>
impl Client<Resolver>
Sourcepub fn with_system_resolver() -> Result<Client<Resolver>>
pub fn with_system_resolver() -> Result<Client<Resolver>>
Create a new client with the system resolver from /etc/resolv.conf
.
Sourcepub fn with_system_resolver_v4() -> Result<Client<Resolver>>
pub fn with_system_resolver_v4() -> Result<Client<Resolver>>
Create a new client with the ipv4 system resolver from /etc/resolv.conf
.
Sourcepub fn with_socks5(proxy: SocketAddr) -> Client<Resolver>
pub fn with_socks5(proxy: SocketAddr) -> Client<Resolver>
Create a new client that is locked to a socks5 proxy
Trait Implementations§
Source§impl<R: DnsResolver + 'static> HttpClient for Client<R>
impl<R: DnsResolver + 'static> HttpClient for Client<R>
Auto Trait Implementations§
impl<R> Freeze for Client<R>
impl<R> !RefUnwindSafe for Client<R>
impl<R> Send for Client<R>
impl<R> Sync for Client<R>
impl<R> Unpin for Client<R>
impl<R> !UnwindSafe for Client<R>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more