Struct isahc::config::Dialer[][src]

pub struct Dialer(_);

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

impl Dialer[src]

pub fn ip_socket(addr: impl Into<SocketAddr>) -> Self[src]

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>()?);

pub fn unix_socket(path: impl Into<PathBuf>) -> Self[src]

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

impl Clone for Dialer[src]

impl Debug for Dialer[src]

impl Default for Dialer[src]

impl From<SocketAddr> for Dialer[src]

impl FromStr for Dialer[src]

type Err = DialerParseError

The associated error which can be returned from parsing.

impl TryFrom<&'_ str> for Dialer[src]

type Error = DialerParseError

The type returned in the event of a conversion error.

impl TryFrom<String> for Dialer[src]

type Error = DialerParseError

The type returned in the event of a conversion error.

impl TryFrom<Uri> for Dialer[src]

type Error = DialerParseError

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]