Struct isahc::config::Dialer

source ·
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, like tcp:127.0.0.1:8080.
  • unix: Connect to a Unix socket located on the file system, like unix:/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

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>()?);
Available on Unix only.

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more