pub struct Dialer(_);
Expand description
A custom address or dialer for connecting to a host.
A dialer can be created from a URI-like string using FromStr
. The
following URI schemes are supported:
tcp
: Connect to a TCP address and port pair, liketcp:127.0.0.1:8080
.unix
: Connect to a Unix socket located on the file system, likeunix:/path/to/my.sock
. This is only supported on Unix.
The Default
dialer uses the hostname and port specified in each request
as normal.
Examples
Connect to a Unix socket URI:
use isahc::config::Dialer;
let unix_socket = "unix:/path/to/my.sock".parse::<Dialer>()?;
Implementations
sourceimpl Dialer
impl Dialer
sourcepub fn ip_socket(addr: impl Into<SocketAddr>) -> Self
pub fn ip_socket(addr: impl Into<SocketAddr>) -> Self
Connect to the given IP socket.
Any value that can be converted into a SocketAddr
can be given as an
argument; check the SocketAddr
documentation for a complete list.
Examples
use isahc::config::Dialer;
use std::net::Ipv4Addr;
let dialer = Dialer::ip_socket((Ipv4Addr::LOCALHOST, 8080));
use isahc::config::Dialer;
use std::net::SocketAddr;
let dialer = Dialer::ip_socket("0.0.0.0:8765".parse::<SocketAddr>()?);
sourcepub fn unix_socket(path: impl Into<PathBuf>) -> Self
This is supported on Unix only.
pub fn unix_socket(path: impl Into<PathBuf>) -> Self
Connect to a Unix socket described by a file.
The path given is not checked ahead of time for correctness or that the socket exists. If the socket is invalid an error will be returned when a request attempt is made.
Examples
use isahc::config::Dialer;
let docker = Dialer::unix_socket("/var/run/docker.sock");
Availability
This function is only available on Unix.
Trait Implementations
sourceimpl From<SocketAddr> for Dialer
impl From<SocketAddr> for Dialer
sourcefn from(socket_addr: SocketAddr) -> Self
fn from(socket_addr: SocketAddr) -> Self
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Dialer
impl Send for Dialer
impl Sync for Dialer
impl Unpin for Dialer
impl UnwindSafe for Dialer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more